From 4e0397e80ab9741dc565f49011ff0eb19de89f58 Mon Sep 17 00:00:00 2001 From: Derek DeMoro Date: Wed, 15 Nov 2006 22:29:25 +0000 Subject: [PATCH] 1) Added conflict check in ReconnectionManager. 2) Fixed compilation errors due to change in interface name. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@6122 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smack/ReconnectionManager.java | 20 +++++++++++++++---- .../filetransfer/FileTransferNegotiator.java | 2 +- .../smackx/muc/MultiUserChat.java | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/source/org/jivesoftware/smack/ReconnectionManager.java b/source/org/jivesoftware/smack/ReconnectionManager.java index 62a7ad43a..835f2169d 100644 --- a/source/org/jivesoftware/smack/ReconnectionManager.java +++ b/source/org/jivesoftware/smack/ReconnectionManager.java @@ -1,5 +1,7 @@ package org.jivesoftware.smack; +import org.jivesoftware.smack.packet.StreamError; + import java.util.ArrayList; import java.util.List; @@ -7,12 +9,12 @@ import java.util.List; * Handles the automatic reconnection process. Every time a connection is dropped without * the application explicitly closing it, the manager automatically tries to reconnect to * the server.

- * + *

* The reconnection mechanism will try to reconnect periodically: *

    - *
  1. First it will try 6 times every 10 seconds. - *
  2. Then it will try 10 times every 1 minute. - *
  3. Finally it will try indefinitely every 5 minutes. + *
  4. First it will try 6 times every 10 seconds. + *
  5. Then it will try 10 times every 1 minute. + *
  6. Finally it will try indefinitely every 5 minutes. *
* * @author Francisco Vives @@ -218,6 +220,16 @@ public class ReconnectionManager implements ConnectionListener { public void connectionClosedOnError(Exception e) { done = false; + if (e instanceof XMPPException) { + XMPPException xmppEx = (XMPPException) e; + StreamError error = xmppEx.getStreamError(); + String reason = error.getCode(); + + if ("conflict".equals(reason)) { + return; + } + } + if (this.isReconnectionAllowed()) { this.reconnect(); } diff --git a/source/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java b/source/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java index de426b9d4..1d60c1663 100644 --- a/source/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java +++ b/source/org/jivesoftware/smackx/filetransfer/FileTransferNegotiator.java @@ -204,7 +204,7 @@ public class FileTransferNegotiator { // ignore } - public void reconectionSuccessful() { + public void reconnectionSuccessful() { // ignore } diff --git a/source/org/jivesoftware/smackx/muc/MultiUserChat.java b/source/org/jivesoftware/smackx/muc/MultiUserChat.java index ba7c5322c..b0de9d19b 100644 --- a/source/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/source/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -2622,7 +2622,7 @@ public class MultiUserChat { // ignore } - public void reconectionSuccessful() { + public void reconnectionSuccessful() { // ignore }