mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +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() {
|
public void shutdown() {
|
||||||
done = true;
|
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) {
|
else if (eventType == XmlPullParser.END_TAG) {
|
||||||
if (parser.getName().equals("stream")) {
|
if (parser.getName().equals("stream")) {
|
||||||
|
// Close the connection.
|
||||||
connection.close();
|
connection.close();
|
||||||
done = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eventType = parser.next();
|
eventType = parser.next();
|
||||||
} while (eventType != XmlPullParser.END_DOCUMENT && !done);
|
} while (!done && eventType != XmlPullParser.END_DOCUMENT);
|
||||||
synchronized (connectionListeners) {
|
|
||||||
for (Iterator i=connectionListeners.iterator(); i.hasNext(); ) {
|
|
||||||
ConnectionListener listener = (ConnectionListener)i.next();
|
|
||||||
listener.connectionClosed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
if (!done) {
|
if (!done) {
|
||||||
|
|
Loading…
Reference in a new issue