SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SendToThread.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #ifndef __SENDTO_THREAD
17 #define __SENDTO_THREAD
18
19 #include "defines.h"
20
21 #ifdef USE_THREADED_SEND
22
23 #include "InternalPacket.h"
24 #include "SocketLayer.h"
25 #include "DS_ThreadsafeAllocatingQueue.h"
26 #include "ThreadPool.h"
27
28 namespace SLNet
29 {
30 class SendToThread
31 {
32 public:
33 SendToThread();
34 ~SendToThread();
35
36 struct SendToThreadBlock
37 {
38 SOCKET s;
39 SystemAddress systemAddress;
40 unsigned short remotePortRakNetWasStartedOn_PS3;
41 unsigned int extraSocketOptions;
42 char data[MAXIMUM_MTU_SIZE];
43 unsigned short dataWriteOffset;
44 };
45
46 static SendToThreadBlock* AllocateBlock(void);
47 static void ProcessBlock(SendToThreadBlock* threadedSend);
48
49 static void AddRef(void);
50 static void Deref(void);
51 static DataStructures::ThreadsafeAllocatingQueue<SendToThreadBlock> objectQueue;
52 protected:
53 static int refCount;
54 static ThreadPool<SendToThreadBlock*,SendToThreadBlock*> threadPool;
55
56 };
57 }
58
59
60 #endif
61
62 #endif