cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject git commit: updated refs/heads/master to aab0bfc
Date Wed, 15 Apr 2015 15:43:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 5506ec993 -> aab0bfc80


CLOUDSTACK-8387 - Close mgmt server peer socket on failure, without relying on autoclose


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/aab0bfc8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aab0bfc8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aab0bfc8

Branch: refs/heads/master
Commit: aab0bfc809c3c818b6fd1123e49e739fda5d28f2
Parents: 5506ec9
Author: MS <m@turboio.com>
Authored: Wed Apr 15 08:43:02 2015 -0700
Committer: Marcus Sorensen <marcus_sorensen@apple.com>
Committed: Wed Apr 15 08:43:02 2015 -0700

----------------------------------------------------------------------
 .../com/cloud/agent/manager/ClusteredAgentManagerImpl.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aab0bfc8/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index 2417f4d..d218cf4 100644
--- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -498,8 +498,9 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements
Clust
                 } catch (UnknownHostException e) {
                     throw new CloudRuntimeException("Unable to resolve " + ip);
                 }
+                SocketChannel ch1;
                 try {
-                    SocketChannel ch1 = SocketChannel.open(new InetSocketAddress(addr, Port.value()));
+                    ch1 = SocketChannel.open(new InetSocketAddress(addr, Port.value()));
                     ch1.configureBlocking(true); // make sure we are working at blocking
mode
                     ch1.socket().setKeepAlive(true);
                     ch1.socket().setSoTimeout(60 * 1000);
@@ -512,6 +513,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements
Clust
                         Link.doHandshake(ch1, sslEngine, true);
                         s_logger.info("SSL: Handshake done");
                     } catch (Exception e) {
+                        ch1.close();
                         throw new IOException("SSL: Fail to init SSL! " + e);
                     }
                     if (s_logger.isDebugEnabled()) {
@@ -521,6 +523,11 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements
Clust
                     _sslEngines.put(peerName, sslEngine);
                     return ch1;
                 } catch (IOException e) {
+                    try {
+                        ch1.close();
+                    } catch (IOException ex) {
+                        s_logger.error("failed to close failed peer socket: " + ex);
+                    }
                     s_logger.warn("Unable to connect to peer management server: " + peerName
+ ", ip: " + ip + " due to " + e.getMessage(), e);
                     return null;
                 }


Mime
View raw message