diff options
author | notsecure <notsecure@marek.ca> | 2014-05-20 20:25:45 +0000 |
---|---|---|
committer | notsecure <notsecure@marek.ca> | 2014-05-20 20:46:51 +0000 |
commit | 2c8f6ffc3f424c06da5ee7070a3efc8424e34fae (patch) | |
tree | fc9ddd634555ce52b5c0a13c22c0eee871cfa39b /toxcore/TCP_server.h | |
parent | 248fd212baa93f06db9845f588003e0ada75c402 (diff) |
epoll for tcp server
Diffstat (limited to 'toxcore/TCP_server.h')
-rw-r--r-- | toxcore/TCP_server.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/toxcore/TCP_server.h b/toxcore/TCP_server.h index 7fd4d976..d585c593 100644 --- a/toxcore/TCP_server.h +++ b/toxcore/TCP_server.h | |||
@@ -27,6 +27,10 @@ | |||
27 | #include "onion.h" | 27 | #include "onion.h" |
28 | #include "list.h" | 28 | #include "list.h" |
29 | 29 | ||
30 | #ifdef TCP_SERVER_USE_EPOLL | ||
31 | #include "sys/epoll.h" | ||
32 | #endif | ||
33 | |||
30 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MACH__) | 34 | #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MACH__) |
31 | #define MSG_NOSIGNAL 0 | 35 | #define MSG_NOSIGNAL 0 |
32 | #endif | 36 | #endif |
@@ -62,6 +66,13 @@ | |||
62 | #define TCP_PING_FREQUENCY 30 | 66 | #define TCP_PING_FREQUENCY 30 |
63 | #define TCP_PING_TIMEOUT 10 | 67 | #define TCP_PING_TIMEOUT 10 |
64 | 68 | ||
69 | #ifdef TCP_SERVER_USE_EPOLL | ||
70 | #define TCP_SOCKET_LISTENING 0 | ||
71 | #define TCP_SOCKET_INCOMING 1 | ||
72 | #define TCP_SOCKET_UNCONFIRMED 2 | ||
73 | #define TCP_SOCKET_CONFIRMED 3 | ||
74 | #endif | ||
75 | |||
65 | enum { | 76 | enum { |
66 | TCP_STATUS_NO_STATUS, | 77 | TCP_STATUS_NO_STATUS, |
67 | TCP_STATUS_CONNECTED, | 78 | TCP_STATUS_CONNECTED, |
@@ -96,6 +107,10 @@ typedef struct TCP_Secure_Connection { | |||
96 | 107 | ||
97 | typedef struct { | 108 | typedef struct { |
98 | Onion *onion; | 109 | Onion *onion; |
110 | |||
111 | #ifdef TCP_SERVER_USE_EPOLL | ||
112 | int efd; | ||
113 | #endif | ||
99 | sock_t *socks_listening; | 114 | sock_t *socks_listening; |
100 | unsigned int num_listening_socks; | 115 | unsigned int num_listening_socks; |
101 | 116 | ||