| |
@@ -79,6 +79,7 @@
|
| |
int dummy = 1;
|
| |
int ret;
|
| |
struct timeval tv;
|
| |
+ unsigned int milli;
|
| |
|
| |
/* SO_KEEPALIVE and TCP_NODELAY are set by OpenLDAP client libraries but
|
| |
* failures are ignored.*/
|
| |
@@ -117,6 +118,16 @@
|
| |
"setsockopt SO_SNDTIMEO failed.[%d][%s].\n", ret,
|
| |
strerror(ret));
|
| |
}
|
| |
+
|
| |
+ milli = timeout * 1000; /* timeout in milliseconds */
|
| |
+ ret = setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, milli,
|
| |
+ sizeof(milli));
|
| |
+ if (ret != 0) {
|
| |
+ ret = errno;
|
| |
+ DEBUG(SSSDBG_FUNC_DATA,
|
| |
+ "setsockopt TCP_USER_TIMEOUT failed.[%d][%s].\n", ret,
|
| |
+ strerror(ret));
|
| |
+ }
|
| |
}
|
| |
|
| |
return EOK;
|
| |
In some cases the TCP connection may hang with data sent because
of network conditions, this may cause the socket to stall for much
longer than the timeout intended.
Set a TCP option to forcibly timeout a socket that sees its data not
ACKed within the ldap_network_timeout seconds.