xapian-core
1.4.27
|
Socket handling utilities. More...
#include "safeunistd.h"
Go to the source code of this file.
Functions | |
void | close_fd_or_socket (int fd) |
void | set_socket_timeouts (int fd, double timeout) |
Attempt to set socket-level timeouts. More... | |
Socket handling utilities.
Definition in file socket_utils.h.
|
inline |
Definition at line 38 of file socket_utils.h.
References close(), and set_socket_timeouts().
Referenced by RemoteConnection::do_close().
void set_socket_timeouts | ( | int | fd, |
double | timeout | ||
) |
Attempt to set socket-level timeouts.
These aren't supported by all platforms, and some platforms allow them to set but ignore them, so we can't easily report failure.
Also sets SO_KEEPALIVE (if supported), which should ensure a stuck connection will eventually time out, though it may take up to ~2 hours.
Definition at line 64 of file socket_utils.cc.
References RealTime::to_timeval(), and usual.
Referenced by close_fd_or_socket().