summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2016-04-26 21:42:23 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-04-27 08:05:08 -0700
commit88a386b9c87072787a3b712073cbf19a74b0bd20 (patch)
treee45be9ec41357e4017785d2b6639d89253b91a8b /rpc/rpc-transport
parent49796290c9772ce49e5a1666cc2f3cc875e59e49 (diff)
rpc: fix gf_process_reserved_ports
this patch also does minor code cleanups. Change-Id: I0d005bd0f9baaaae498aa1df4faa6fcb65fa7a6e BUG: 1198849 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Reviewed-on: http://review.gluster.org/13997 Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'rpc/rpc-transport')
-rw-r--r--rpc/rpc-transport/rdma/src/name.c8
-rw-r--r--rpc/rpc-transport/socket/src/name.c10
2 files changed, 3 insertions, 15 deletions
diff --git a/rpc/rpc-transport/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c
index 93b249855e1..d4502e766bf 100644
--- a/rpc/rpc-transport/rdma/src/name.c
+++ b/rpc/rpc-transport/rdma/src/name.c
@@ -56,15 +56,9 @@ af_inet_bind_to_port_lt_ceiling (struct rdma_cm_id *cm_id,
{
int32_t ret = -1;
uint16_t port = ceiling - 1;
- /* by default assume none of the ports are blocked and all are available */
- gf_boolean_t ports[GF_PORT_MAX] = {_gf_false,};
- int i = 0;
+ gf_boolean_t ports[GF_PORT_MAX];
ret = gf_process_reserved_ports (ports, ceiling);
- if (ret != 0) {
- for (i = 0; i < GF_PORT_MAX; i++)
- ports[i] = _gf_false;
- }
while (port) {
/* ignore the reserved ports */
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index 725a8c18120..12887a72ff1 100644
--- a/rpc/rpc-transport/socket/src/name.c
+++ b/rpc/rpc-transport/socket/src/name.c
@@ -44,19 +44,13 @@ af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
{
int32_t ret = -1;
uint16_t port = ceiling - 1;
- // by default assume none of the ports are blocked and all are available
- gf_boolean_t ports[GF_PORT_MAX] = {_gf_false,};
- int i = 0;
+ gf_boolean_t ports[GF_PORT_MAX];
ret = gf_process_reserved_ports (ports, ceiling);
- if (ret != 0) {
- for (i = 0; i < GF_PORT_MAX; i++)
- ports[i] = _gf_false;
- }
while (port)
{
- // ignore the reserved ports
+ /* ignore the reserved ports */
if (ports[port] == _gf_true) {
port--;
continue;