More limits to damage done by write <-> write and disconnected hsots.

This commit is contained in:
Ian Gulliver
2016-02-28 23:03:18 -08:00
parent 5c7bf0b395
commit d842ad65bb

View File

@@ -39,6 +39,14 @@ void socket_send_init(int fd) {
int optval = 128; // Lowest value that the kernel will accept int optval = 128; // Lowest value that the kernel will accept
res = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval)); res = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval));
assert(res == 0 || (res == -1 && errno == ENOTSOCK)); assert(res == 0 || (res == -1 && errno == ENOTSOCK));
optval = 128; // Lowest value that the kernel will accept
res = setsockopt(fd, IPPROTO_TCP, TCP_WINDOW_CLAMP, &optval, sizeof(optval));
assert(res == 0 || (res == -1 && errno == ENOTSOCK));
optval = 60000; // 60s
res = setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &optval, sizeof(optval));
assert(res == 0 || (res == -1 && errno == ENOTSOCK));
} }
void socket_receive_init(int fd) { void socket_receive_init(int fd) {