mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 01:29:38 +02:00
SMACK-417 If both PacketReader and PacketWriter fail at the same time, connectionClosedonError() is called two times
Refactored notifyConnectionError() and notifyReconnection() from PacketReader to XMPPConnection. Made PacketReader.done and PacketWriter.done volatile. Prevent duplicate connectionClosedonError() calls by making the method synchronzied and protected them with an enter guard: if (packetReader.done && packetWriter.done) return; git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_0@13568 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
6dcf8e0123
commit
a55b54f20b
5 changed files with 65 additions and 61 deletions
|
@ -44,7 +44,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
connection.addConnectionListener(listener);
|
||||
|
||||
// Simulates an error in the connection
|
||||
connection.packetReader.notifyConnectionError(new Exception("Simulated Error"));
|
||||
connection.notifyConnectionError(new Exception("Simulated Error"));
|
||||
Thread.sleep(12000);
|
||||
// After 10 seconds, the reconnection manager must reestablishes the connection
|
||||
assertEquals("The ConnectionListener.connectionStablished() notification was not fired",
|
||||
|
@ -79,7 +79,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
connection.addConnectionListener(listener);
|
||||
|
||||
// Simulates an error in the connection
|
||||
connection.packetReader.notifyConnectionError(new Exception("Simulated Error"));
|
||||
connection.notifyConnectionError(new Exception("Simulated Error"));
|
||||
Thread.sleep(12000);
|
||||
// After 10 seconds, the reconnection manager must reestablishes the connection
|
||||
assertEquals("The ConnectionListener.connectionStablished() notification was not fired",
|
||||
|
@ -103,7 +103,7 @@ public class ReconnectionTest extends SmackTestCase {
|
|||
connection.addConnectionListener(listener);
|
||||
|
||||
// Produces a connection error
|
||||
connection.packetReader.notifyConnectionError(new Exception("Simulated Error"));
|
||||
connection.notifyConnectionError(new Exception("Simulated Error"));
|
||||
assertEquals(
|
||||
"An error occurs but the ConnectionListener.connectionClosedOnError(e) was not notified",
|
||||
true, listener.connectionClosedOnError);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue