From c4592550d645aa5d1fb5edd64a5cff6e91a4bcdd Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Thu, 18 Oct 2012 09:40:05 +0200 Subject: [PATCH] Move iscsi_set_tcp_keepalive after socket creation Socket options should be set directly after socket creation. --- lib/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/socket.c b/lib/socket.c index 8ec437a..806ce7b 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -157,6 +157,7 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal, iscsi->connect_data = private_data; set_nonblocking(iscsi->fd); + iscsi_set_tcp_keepalive(iscsi, 30, 3, 30); if (connect(iscsi->fd, ai->ai_addr, socksize) != 0 && errno != EINPROGRESS) { @@ -437,7 +438,6 @@ iscsi_service(struct iscsi_context *iscsi, int revents) return -1; } - iscsi_set_tcp_keepalive(iscsi, 30, 3, 30); iscsi->is_connected = 1; iscsi->socket_status_cb(iscsi, SCSI_STATUS_GOOD, NULL, iscsi->connect_data);