4e210da629354999e687824f2fcd4fb048d19d58

---

** [bugs:#684] SarosNet is reporting wrong Connection States**

**Status:** open-fixed
**Labels:** Network Layer 
**Created:** Sun Feb 26, 2012 10:04 PM UTC by Stefan Rossbach
**Last Updated:** Thu Feb 14, 2013 02:12 PM UTC
**Owner:** Stefan Rossbach

The connection state logic defines:

// . . . . . 
/------------------------------------------------------------------\
// . . . . . | . . . . . . . .................................... . . . . . . 
.. |
// . . . . . v . . . . . . . . . . ................................... . . . .. 
|
// o-> NOT\_CONNECTED ----> CONNECTING <---> ERROR
// . . . . . ^ . . . . .......................... . . . | . . . ............ . 
.. ^
// . . . . . | . . . . . .......................... . . v . . . . . 
............. |
// . . DISCONNECTING <---- CONNECTED ----------------/

but Smack will report:

If you look at Smacks packetReader

void notifyConnectionError\(Exception e\) \{
done = true;
// Closes the connection temporary. A reconnection is possible
connection.shutdown\(new Presence\(Presence.Type.unavailable\)\);
// Print the stack trace to help catch the problem
e.printStackTrace\(\);
// Notify connection listeners of the error.
for \(ConnectionListener listener : connection.getConnectionListeners\(\)\) \{
try \{
listener.connectionClosedOnError\(e\);
\}
catch \(Exception e2\) \{
// Catch and print any exception so we can recover
// from a faulty listener
e2.printStackTrace\(\);
\}
\}
\}

And XMPPConnection.shutdown

protected void shutdown\(Presence unavailablePresence\) \{
// Set presence to offline.
packetWriter.sendPacket\(unavailablePresence\);

this.setWasAuthenticated\(authenticated\);
authenticated = false;
connected = false;

packetReader.shutdown\(\);
packetWriter.shutdown\(\);

.......

again in the packetReader:

/\*\*
\* Shuts the packet reader down.
\*/
public void shutdown\(\) \{
// Notify connection listeners of the connection closing if done hasn't already 
been set.
if \(\!done\) \{
for \(ConnectionListener listener : connection.getConnectionListeners\(\)\) \{
try \{
listener.connectionClosed\(\);
\}
catch \(Exception e\) \{
// Cath and print any exception so we can recover
// from a faulty listener and finish the shutdown process
e.printStackTrace\(\);
\}
\}
\}
done = true;

// Shut down the listener executor.
listenerExecutor.shutdown\(\);
\}

Given the current implementation logic from SarosNet this will result into the 
following calls to the listeners:

NOT\_CONNECTED ----> CONNECTING ---> NOT\_CONNECTED --> ERROR ---> 
NOT\_CONNECTED   which might prevent listeners from properly
cleaning up all stuff because they are called with wrong states.




---

Sent from sourceforge.net because you indicated interest in 
<https://sourceforge.net/p/dpp/bugs/684/>

To unsubscribe from further messages, please visit 
<https://sourceforge.net/auth/prefs/>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Dpp-robot mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dpp-robot

Reply via email to