diff options
author | Anand V. Avati <avati@blackhole.gluster.com> | 2010-08-12 05:05:02 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-08-12 03:55:16 -0700 |
commit | 12ce6a962aee3674eb722a09241b43923712ee8e (patch) | |
tree | 61b9e822a8dc398e24c654378fcfd886ce51c447 /rpc/rpc-transport/socket/src/socket.c | |
parent | b69a4f1e31726260a07f883cefac28ed29cc6a12 (diff) |
rpc-clnt/socket: rpc_clnt_reconfig() API to support overriding of port numbers
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1314 (portmapper functionality)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1314
Diffstat (limited to 'rpc/rpc-transport/socket/src/socket.c')
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index e544332c0..31b5a82ea 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -1672,7 +1672,7 @@ socket_disconnect (rpc_transport_t *this) int -socket_connect (rpc_transport_t *this) +socket_connect (rpc_transport_t *this, int port) { int ret = -1; int sock = -1; @@ -1711,6 +1711,9 @@ socket_connect (rpc_transport_t *this) goto err; } + if (port > 0) + ((struct sockaddr_in *) (&sockaddr))->sin_port = htons (port); + pthread_mutex_lock (&priv->lock); { if (priv->sock != -1) { @@ -2228,7 +2231,7 @@ struct rpc_transport_ops tops = { .get_peername = socket_getpeername, .get_peeraddr = socket_getpeeraddr, .get_myname = socket_getmyname, - .get_myaddr = socket_getmyaddr + .get_myaddr = socket_getmyaddr, }; |