diff options
Diffstat (limited to 'rpc/rpc-transport/socket/src/socket.c')
-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 94b243bab15..bd3f271cf1a 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -2752,6 +2752,7 @@ socket_connect (rpc_transport_t *this, int port) socket_connect_error_state_t *arg = NULL; pthread_t th_id = {0, }; char *cname = NULL; + gf_boolean_t ign_enoent = _gf_false; GF_VALIDATE_OR_GOTO ("socket", this, err); GF_VALIDATE_OR_GOTO ("socket", this->private, err); @@ -2871,6 +2872,10 @@ socket_connect (rpc_transport_t *this, int port) &(addr->sin_addr.s_addr)); } + /* If client wants ENOENT to be ignored */ + ign_enoent = dict_get_str_boolean (this->options, + "transport.socket.ignore-enoent", _gf_false); + ret = client_bind (this, SA (&this->myinfo.sockaddr), &this->myinfo.sockaddr_len, priv->sock); if (ret == -1) { @@ -2892,6 +2897,13 @@ socket_connect (rpc_transport_t *this, int port) ret = connect (priv->sock, SA (&this->peerinfo.sockaddr), this->peerinfo.sockaddr_len); + if (ret == -1 && errno == ENOENT && ign_enoent) { + gf_log (this->name, GF_LOG_WARNING, + "Ignore failed connection attempt on %s, (%s) ", + this->peerinfo.identifier, strerror (errno)); + goto handler; + } + if (ret == -1 && ((errno != EINPROGRESS) && (errno != ENOENT))) { /* For unix path based sockets, the socket path is * cryptic (md5sum of path) and may not be useful for |