From 120eca5ceee2c1fdea37ddf84f5e4161a8885b86 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Thu, 25 Sep 2008 12:54:56 +0000 Subject: [PATCH] Avoid loops on SocketException comming from msn lib. --- .../msn/ProtocolProviderServiceMsnImpl.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java index 91d9e5844..3da777964 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java @@ -65,7 +65,7 @@ public class ProtocolProviderServiceMsnImpl */ private ProtocolIconMsnImpl msnIcon = new ProtocolIconMsnImpl(); - + /** * Returns the state of the registration of this protocol provider * @return the RegistrationState that this provider is @@ -103,7 +103,7 @@ public void register(final SecurityAuthority authority) connectAndLogin(authority, SecurityAuthority.AUTHENTICATION_REQUIRED); } - + /** * Reconnects if fails fire connection failed. * @param reasonCode the appropriate SecurityAuthority reasonCode, @@ -161,7 +161,7 @@ private void connectAndLogin(SecurityAuthority authority, int reasonCode) RegistrationStateChangeEvent.REASON_USER_REQUEST, ""); return; } - + //extract the password the user passed us. char[] pass = credentials.getPassword(); @@ -444,8 +444,17 @@ public void exceptionCaught(MsnMessenger msnMessenger, // We try to reconnect and ask user to retype password. reconnect(SecurityAuthority.WRONG_PASSWORD); } - else if(throwable instanceof UnknownHostException - || throwable instanceof SocketException) + else if(throwable instanceof SocketException) + { + // in case of SocketException just fire event and not trigger + // unregister it will cause SocketException again and will loop + fireRegistrationStateChanged( + getRegistrationState(), + RegistrationState.CONNECTION_FAILED, + RegistrationStateChangeEvent.REASON_INTERNAL_ERROR, + null); + } + else if(throwable instanceof UnknownHostException) { unregister(false); @@ -514,7 +523,7 @@ else if(throwable instanceof UnknownHostException } } } - + /** * Returns the msn protocol icon. * @return the msn protocol icon