hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From y...@apache.org
Subject incubator-hawq git commit: HAWQ-664. The return value of registering fd is not checked for asynchronous connection
Date Wed, 13 Apr 2016 01:36:45 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 5553271a6 -> 17389e39a


HAWQ-664. The return value of registering fd is not checked for asynchronous connection


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/17389e39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/17389e39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/17389e39

Branch: refs/heads/master
Commit: 17389e39a6d5cc1f40b18694779d5228dc749de8
Parents: 5553271
Author: YI JIN <yjin@pivotal.io>
Authored: Wed Apr 13 11:36:22 2016 +1000
Committer: YI JIN <yjin@pivotal.io>
Committed: Wed Apr 13 11:36:22 2016 +1000

----------------------------------------------------------------------
 .../communication/rmcomm_AsyncComm.c            | 74 +++++++++++---------
 1 file changed, 41 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/17389e39/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c b/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c
index ee005bf..f2203db 100644
--- a/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c
+++ b/src/backend/resourcemanager/communication/rmcomm_AsyncComm.c
@@ -691,7 +691,7 @@ int registerAsyncConnectionFileDesc(const char				*address,
 							   methods,
 							   userdata,
 							   newcommbuffer);
-		goto exit;
+		return res;
 	}
 
 	/* Create socket FD */
@@ -725,27 +725,30 @@ int registerAsyncConnectionFileDesc(const char				*address,
 		if ( setConnectionLongTermNoDelay(fd) != FUNC_RETURN_OK )
 		{
 			close(fd);
-			res = UTIL_NETWORK_FAIL_CONNECT;
-			goto exit;
+			return UTIL_NETWORK_FAIL_CONNECT;
 		}
 		/*
 		 * New connection is created. Suppose domain socket and local socket
 		 * connection can be done now. Register a normal client FD in poll() to
 		 * perform content sending and receiving.
 		 */
-		res = registerFileDesc(fd,
-							   actionmask,
-							   methods,
-							   userdata,
-							   newcommbuffer);
-
-		/* Assign connection address. */
-		assignFileDescClientAddressInfo(*newcommbuffer,
-										address,
-										port,
-										&server_addr,
-										sizeof(server_addr));
-		goto exit;
+		res = registerFileDesc(fd, actionmask, methods, userdata, newcommbuffer);
+		if ( res == FUNC_RETURN_OK )
+		{
+			/* Assign connection address. */
+			assignFileDescClientAddressInfo(*newcommbuffer,
+											address,
+											port,
+											&server_addr,
+											sizeof(server_addr));
+		}
+		else
+		{
+			write_log("registerAsyncCommectionFileDesc failed registering fd %d.",
+					  fd);
+			close(fd);
+			res = UTIL_NETWORK_FAIL_CONNECT;
+		}
 	}
 	else if ( sockres < 0 && errno == EINPROGRESS )
 	{
@@ -758,27 +761,32 @@ int registerAsyncConnectionFileDesc(const char				*address,
 										   methods,
 										   userdata,
 										   newcommbuffer);
-
-		/* Assign connection address. */
-		assignFileDescClientAddressInfo(*newcommbuffer,
-										address,
-										port,
-										&server_addr,
-										sizeof(server_addr));
-
-		goto exit;
+		if ( res == FUNC_RETURN_OK )
+		{
+			/* Assign connection address. */
+			assignFileDescClientAddressInfo(*newcommbuffer,
+											address,
+											port,
+											&server_addr,
+											sizeof(server_addr));
+		}
+		else
+		{
+			write_log("registerAsyncCommectionFileDesc failed registering fd %d.",
+					  fd);
+			close(fd);
+			res = UTIL_NETWORK_FAIL_CONNECT;
+		}
 	}
 	else
 	{
 		/* Fail to build connection. */
-		 write_log("registerAsyncConnectionFileDesc connect socket failed, "
-				   "fd %d (errno %d)",
-				   fd,
-				   errno);
-		 close(fd);
-		 res = UTIL_NETWORK_FAIL_CONNECT;
+		write_log("registerAsyncConnectionFileDesc connect socket failed, "
+				  "fd %d (errno %d)",
+				  fd,
+				  errno);
+		close(fd);
+		res = UTIL_NETWORK_FAIL_CONNECT;
 	}
-
-exit:
 	return res;
 }


Mime
View raw message