|
414 |
}; |
414 |
}; |
415 |
int ret; |
415 |
int ret; |
416 |
ret = setsockopt(client->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); |
416 |
ret = setsockopt(client->fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); |
417 |
if (ret < 0) |
417 |
if (ret < 0) { |
418 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set SO_RCVTIMEO\n"); |
418 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set SO_RCVTIMEO\n"); |
|
|
419 |
} |
419 |
ret = setsockopt(client->fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); |
420 |
ret = setsockopt(client->fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); |
420 |
if (ret < 0) |
421 |
if (ret < 0) { |
421 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set SO_SNDTIMEO\n"); |
422 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set SO_SNDTIMEO\n"); |
|
|
423 |
} |
422 |
|
424 |
|
423 |
const int enable = 1; |
425 |
const int enable = 1; |
424 |
ret = setsockopt(client->fd, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable)); |
426 |
ret = setsockopt(client->fd, SOL_SOCKET, SO_KEEPALIVE, &enable, sizeof(enable)); |
425 |
if (ret < 0) |
427 |
if (ret < 0) { |
426 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to enable TCP KEEPALIVE\n"); |
428 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to enable TCP KEEPALIVE\n"); |
|
|
429 |
} |
427 |
const int idle = 60; |
430 |
const int idle = 60; |
428 |
ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); |
431 |
ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); |
429 |
if (ret < 0) |
432 |
if (ret < 0) { |
430 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPIDLE\n"); |
433 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPIDLE\n"); |
|
|
434 |
} |
431 |
const int probes = 12; |
435 |
const int probes = 12; |
432 |
ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPCNT, &probes, sizeof(probes)); |
436 |
ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPCNT, &probes, sizeof(probes)); |
433 |
if (ret < 0) |
437 |
if (ret < 0) { |
434 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPCNT\n"); |
438 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPCNT\n"); |
|
|
439 |
} |
435 |
const int interval = 5; |
440 |
const int interval = 5; |
436 |
ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPINTVL, &interval, sizeof(interval)); |
441 |
ret = setsockopt(client->fd, SOL_TCP, TCP_KEEPINTVL, &interval, sizeof(interval)); |
437 |
if (ret < 0) |
442 |
if (ret < 0) { |
438 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPINTVL\n"); |
443 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to set TCP_KEEPINTVL\n"); |
|
|
444 |
} |
439 |
} |
445 |
} |
440 |
|
446 |
|
441 |
if (connect(client->fd, address, addrlen) == -1) { |
447 |
if (connect(client->fd, address, addrlen) == -1) { |