1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

SMACK-278: Call socket.close() in XMPPConnection.shutdown() before

closing the reader and writer streams. This basically prevents the
deadlock reported in SMACK-278.

Additionally, we need to tell the PacketReader and PacketWriter that
the socket got closed and that subsequent caused Exceptions can be
ignored. This is done via the socketClosed boolean in XMPP Connection,
that is queried by PacketReader and PacketWriter in case an Exception
is encountered.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13390 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-01-06 14:02:44 +00:00 committed by flow
parent 3c2eaba840
commit e1bb5a6123
3 changed files with 57 additions and 10 deletions

View file

@ -26,6 +26,7 @@ import org.jivesoftware.smack.sasl.SASLMechanism.Challenge;
import org.jivesoftware.smack.sasl.SASLMechanism.Failure;
import org.jivesoftware.smack.sasl.SASLMechanism.Success;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.xmlpull.mxp1.MXParser;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@ -326,7 +327,9 @@ class PacketReader {
} while (!done && eventType != XmlPullParser.END_DOCUMENT && thread == readerThread);
}
catch (Exception e) {
if (!done) {
// The exception can be ignored if the the connection is 'done'
// or if the it was caused because the socket got closed
if (!(done || connection.isSocketClosed())) {
// Close the connection and notify connection listeners of the
// error.
notifyConnectionError(e);
@ -454,4 +457,4 @@ class PacketReader {
}
}
}
}
}