summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2010-08-19 02:06:03 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-19 02:38:07 -0700
commitb1f5031a3aa7c733990d0441a921c0b100309304 (patch)
tree5fec3fa60e11277167617b3aaa8e62d52bb8f4f2 /rpc/rpc-lib
parentf51252fa0d89556542fdfd190e8a94b28b013c36 (diff)
rpcsvc: change in port selection criteria for program to listen on.
- give preference to port specified in options over the port in program structure when both are specified. This will enable us to run multiple glusterfs server instances on the same machine. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1396 ([3.1prealpha3] Multiple glusterfs processes fail to start with different port nos) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1396
Diffstat (limited to 'rpc/rpc-lib')
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index c4c9fcaa286..2b6ed58f07b 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -1680,9 +1680,7 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program)
memcpy (newprog, &program, sizeof (program));
listen_port = RPCSVC_DEFAULT_LISTEN_PORT;
- if (program.progport != 0) {
- listen_port = program.progport;
- } else if (program.options != NULL) {
+ if (program.options != NULL) {
/*
* FIXME: use a method which does not hard-code each transport's
* option keys.
@@ -1701,6 +1699,8 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program)
!= NULL) {
listen_port = data_to_uint16 (listen_port_data);
}
+ } else if (program.progport != 0) {
+ listen_port = program.progport;
}
listener = rpcsvc_get_listener (svc, listen_port, NULL);
@@ -1716,7 +1716,8 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program)
rpcsvc_listener_destroy (listener);
}
- if (program.progport != 0) {
+ if ((program.progport != 0)
+ && (listen_port == program.progport)) {
ret = dict_set (program.options,
"transport.socket.listen-port",
data_from_uint16 (listen_port));