Set SO_KEEPALIVE before TCP_USER_TIMEOUT

For TCP_USER_TIMEOUT to work it seems to be necessary that SO_KEEPALIVE is
enabled. RFC5482 section 4.2 also says that the TCP_USER_TIMEOUT has to be
less than the keepalive timeout. This means less than 30000 ms in the
current libiscsi default settings for TCP keepalives.
This commit is contained in:
Peter Lieven
2012-10-18 14:31:09 +02:00
parent 326b2ea49d
commit cc2b0c9b1d

View File

@@ -160,13 +160,11 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
set_nonblocking(iscsi->fd);
iscsi_set_tcp_keepalive(iscsi, 30, 3, 30);
if (iscsi->tcp_user_timeout > 0) {
set_tcp_user_timeout(iscsi);
}
else
{
iscsi_set_tcp_keepalive(iscsi, 30, 3, 30);
}
if (connect(iscsi->fd, ai->ai_addr, socksize) != 0
&& errno != EINPROGRESS) {