Fix ICQ connection problems. and many error messages

cusax-fix
Damian Minkov 20 years ago
parent 84979f098d
commit 81b7382c54

@ -106,7 +106,7 @@ public class OperationSetBasicInstantMessagingIcqImpl
/**
* The timer executing tasks on specified intervals
*/
private Timer keepAliveTimer = new Timer();
private Timer keepAliveTimer = null;
/**
* The queue holding the received packets
*/
@ -449,11 +449,25 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt)
if(keepAliveSendTask == null)
{
keepAliveSendTask = new KeepAliveSendTask();
keepAliveTimer = new Timer();
keepAliveTimer.scheduleAtFixedRate(
keepAliveSendTask, KEEPALIVE_INTERVAL, KEEPALIVE_INTERVAL);
}
}
else
if (evt.getNewState() == RegistrationState.UNREGISTERED)
{
// stop keepalive thread
if (keepAliveSendTask != null)
{
keepAliveSendTask.cancel();
keepAliveTimer.cancel();
keepAliveSendTask = null;
keepAliveTimer = null;
}
}
}
}

@ -540,6 +540,14 @@ void fireRegistrationStateChanged( RegistrationState oldState,
new RegistrationStateChangeEvent(
this, oldState, newState, reasonCode, reason);
if(newState.equals(RegistrationState.CONNECTION_FAILED) &&
isRegistered())
{
// if for some reason (keep alive failed) and connection is
// still connected disconneted
unregister();
}
logger.debug("Dispatching " + event + " to "
+ registrationListeners.size()+ " listeners.");

Loading…
Cancel
Save