|
|
|
@ -275,6 +275,16 @@ struct ETCP_SOCKET* etcp_socket_add(struct UTUN_INSTANCE* instance, struct socka |
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "Failed to set SO_REUSEADDR: %s", strerror(errno)); |
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "Failed to set SO_REUSEADDR: %s", strerror(errno)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Increase socket buffers for high throughput
|
|
|
|
|
|
|
|
int sndbuf = 4 * 1024 * 1024; // 4MB send buffer
|
|
|
|
|
|
|
|
int rcvbuf = 4 * 1024 * 1024; // 4MB receive buffer
|
|
|
|
|
|
|
|
if (setsockopt(e_sock->fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)) < 0) { |
|
|
|
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "Failed to set SO_SNDBUF: %s", strerror(errno)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (setsockopt(e_sock->fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)) < 0) { |
|
|
|
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_CONNECTION, "Failed to set SO_RCVBUF: %s", strerror(errno)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int flags = fcntl(e_sock->fd, F_GETFL, 0); |
|
|
|
int flags = fcntl(e_sock->fd, F_GETFL, 0); |
|
|
|
fcntl(e_sock->fd, F_SETFL, flags | O_NONBLOCK); |
|
|
|
fcntl(e_sock->fd, F_SETFL, flags | O_NONBLOCK); |
|
|
|
|
|
|
|
|
|
|
|
|