1
0
Fork 0
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:
Florian Schmaus 2013-03-18 19:58:48 +00:00 committed by flow
parent 6dcf8e0123
commit a55b54f20b
5 changed files with 65 additions and 61 deletions

View file

@ -44,7 +44,7 @@ class PacketWriter {
private Writer writer;
private XMPPConnection connection;
private final BlockingQueue<Packet> queue;
private boolean done;
volatile boolean done;
/**
* Timestamp when the last stanza was sent to the server. This information is used
@ -245,7 +245,7 @@ class PacketWriter {
// packetReader could be set to null by an concurrent disconnect() call.
// Therefore Prevent NPE exceptions by checking packetReader.
if (connection.packetReader != null) {
connection.packetReader.notifyConnectionError(ioe);
connection.notifyConnectionError(ioe);
}
}
}