1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +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:
Matt Tucker 2003-07-16 02:49:43 +00:00 committed by mtucker
parent 40624c9c0b
commit e256a1d149

View file

@ -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) {