- **status**: open-fixed --> closed-fixed
- **Group**: 13.3.29 --> 13.12.6



---

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

**Status:** closed-fixed
**Labels:** Network Layer 
**Created:** Sun Feb 26, 2012 10:04 PM UTC by Stefan Rossbach
**Last Updated:** Mon Mar 18, 2013 12:10 AM 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 [email protected] is subscribed 
to https://sourceforge.net/p/dpp/bugs/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/dpp/admin/bugs/options.  Or, if this is a mailing 
list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Dpp-robot mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dpp-robot

Reply via email to