diff options
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index c77882dd6de..5545f7e2ebe 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1411,8 +1411,12 @@ rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog, pthread_mutex_lock (&conn->lock); { if (conn->connected == 0) { - rpc_transport_connect (conn->trans, - conn->config.remote_port); + ret = rpc_transport_connect (conn->trans, + conn->config.remote_port); + /* Below code makes sure the (re-)configured port lasts + for just one successful connect attempt */ + if (!ret) + conn->config.remote_port = 0; } ret = rpc_transport_submit_request (rpc->conn.trans, |