From 9693b97c2147b3fdb9579a1ebb33597cd3bf1d11 Mon Sep 17 00:00:00 2001 From: Boris Schrijver Date: Mon, 21 Sep 2015 16:54:56 +0200 Subject: [PATCH] Call cleanUp() before looping isStartup(). --- agent/src/com/cloud/agent/Agent.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/agent/src/com/cloud/agent/Agent.java b/agent/src/com/cloud/agent/Agent.java index e3510c41c32..f39d0e78961 100644 --- a/agent/src/com/cloud/agent/Agent.java +++ b/agent/src/com/cloud/agent/Agent.java @@ -394,15 +394,17 @@ public class Agent implements HandlerFactory, IAgentControl { } while (inProgress > 0); _connection.stop(); - while (_connection.isStartup()) { - _shell.getBackoffAlgorithm().waitBeforeRetry(); - } try { _connection.cleanUp(); } catch (final IOException e) { s_logger.warn("Fail to clean up old connection. " + e); } + + while (_connection.isStartup()) { + _shell.getBackoffAlgorithm().waitBeforeRetry(); + } + _connection = new NioClient("Agent", _shell.getHost(), _shell.getPort(), _shell.getWorkers(), this); do { s_logger.info("Reconnecting...");