From ae404f047e0c9c912f425d437b3840b82c1eb37f Mon Sep 17 00:00:00 2001 From: "selva.andre" Date: Tue, 31 Jul 2012 22:21:33 +0200 Subject: [PATCH] Removed retries policy during the send of CONNECT message --- .../org/dna/mqtt/moquette/client/Client.java | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/parser/src/main/java/org/dna/mqtt/moquette/client/Client.java b/parser/src/main/java/org/dna/mqtt/moquette/client/Client.java index 0c5f91f8..91fab195 100644 --- a/parser/src/main/java/org/dna/mqtt/moquette/client/Client.java +++ b/parser/src/main/java/org/dna/mqtt/moquette/client/Client.java @@ -100,23 +100,14 @@ public final class Client { public void connect() throws MQTTException { int retries = 0; - //TODO perhaps by proto deinifinition should be an implicit retry policy -// for (; retries < m_connectRetries; retries++) { - try { - ConnectFuture future = m_connector.connect(new InetSocketAddress(m_hostname, m_port)); - LOG.fine("Client waiting to connect to server"); - future.awaitUninterruptibly(); - m_session = future.getSession(); -// break; - } catch (RuntimeIoException e) { - LOG.log(Level.FINE, "Failed to connect, retry " + retries + " of ("+m_connectRetries+")", e); - } -// try { -// Thread.sleep(1000); -// } catch (InterruptedException ex) { -// LOG.log(Level.SEVERE, "Error while sleeping for retry", ex); -// } -// } + try { + ConnectFuture future = m_connector.connect(new InetSocketAddress(m_hostname, m_port)); + LOG.fine("Client waiting to connect to server"); + future.awaitUninterruptibly(); + m_session = future.getSession(); + } catch (RuntimeIoException e) { + LOG.log(Level.FINE, "Failed to connect, retry " + retries + " of ("+m_connectRetries+")", e); + } if (retries == m_connectRetries) { throw new MQTTException("Can't connect to the server after " + retries + "retries");