diff options
author | Krishnan Parthasarathi <kparthas@redhat.com> | 2013-03-14 09:48:08 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-04-12 00:20:46 -0700 |
commit | 435c693165a3c7b739c1b71ff179d1507c8d496d (patch) | |
tree | da8f58bc1aa5d55062def4d8a2283b00850fc639 /rpc | |
parent | 1a40438f210ecab26a8fa1e3ca8fce01cf0623dc (diff) |
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/4685
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index fffc137f6..3f189e3b9 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -2758,6 +2758,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); |