socket: Make non-ssl sockets perform non-blocking connect()

Change-Id: Icb60cf7ad3ea7ca0eeb12fd19b95a6b340857bb2
BUG: 920916
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4670
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
Krishnan Parthasarathi 2013-03-14 09:48:08 +05:30 committed by Anand Avati
parent 76bc5d1b2d
commit fec34ce453

View File

@ -2760,6 +2760,18 @@ socket_connect (rpc_transport_t *this, int port)
goto unlock;
}
if (!priv->use_ssl && !priv->bio && !priv->own_thread) {
ret = __socket_nonblock (priv->sock);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
"NBIO on %d failed (%s)",
priv->sock, strerror (errno));
close (priv->sock);
priv->sock = -1;
goto unlock;
}
}
ret = connect (priv->sock, SA (&this->peerinfo.sockaddr),
this->peerinfo.sockaddr_len);