mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-24 03:27:59 +01:00
Better connection closing notification logic.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1987 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
40624c9c0b
commit
e256a1d149
1 changed files with 9 additions and 8 deletions
|
@ -201,6 +201,13 @@ class PacketReader {
|
|||
*/
|
||||
public void shutdown() {
|
||||
done = true;
|
||||
// Notify connection listeners of the connection closing.
|
||||
synchronized (connectionListeners) {
|
||||
for (Iterator i=connectionListeners.iterator(); i.hasNext(); ) {
|
||||
ConnectionListener listener = (ConnectionListener)i.next();
|
||||
listener.connectionClosed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,18 +278,12 @@ class PacketReader {
|
|||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("stream")) {
|
||||
// Close the connection.
|
||||
connection.close();
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
eventType = parser.next();
|
||||
} while (eventType != XmlPullParser.END_DOCUMENT && !done);
|
||||
synchronized (connectionListeners) {
|
||||
for (Iterator i=connectionListeners.iterator(); i.hasNext(); ) {
|
||||
ConnectionListener listener = (ConnectionListener)i.next();
|
||||
listener.connectionClosed();
|
||||
}
|
||||
}
|
||||
} while (!done && eventType != XmlPullParser.END_DOCUMENT);
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (!done) {
|
||||
|
|
Loading…
Reference in a new issue