Commit 4e2a0280 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Fix that avoids an annoying warning when a client's connection sent an end of stream element.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@729 b35dd754-fafc-0310-a699-88a17e54d16e
parent c1567318
......@@ -175,38 +175,40 @@ public class SocketReadThread extends Thread {
*/
private void readStream() throws Exception {
while (true) {
Document document = reader.parseDocument();
Element doc = reader.parseDocument().getRootElement();
if (document != null) {
Element doc = document.getRootElement();
if (doc == null) {
// Stop reading the stream since the client has sent an end of stream element and
// probably closed the connection
return;
}
String tag = doc.getName();
if ("message".equals(tag)) {
Message packet = new Message(doc);
packet.setFrom(session.getAddress());
auditor.audit(packet, session);
router.route(packet);
session.incrementClientPacketCount();
}
else if ("presence".equals(tag)) {
Presence packet = new Presence(doc);
packet.setFrom(session.getAddress());
auditor.audit(packet, session);
router.route(packet);
session.incrementClientPacketCount();
// Update the flag that indicates if the user made a clean sign out
clearSignout = (Presence.Type.unavailable == packet.getType() ? true : false);
}
else if ("iq".equals(tag)) {
IQ packet = getIQ(doc);
packet.setFrom(session.getAddress());
auditor.audit(packet, session);
router.route(packet);
session.incrementClientPacketCount();
}
else {
throw new XmlPullParserException(LocaleUtils.getLocalizedString("admin.error.packet.tag") + tag);
}
String tag = doc.getName();
if ("message".equals(tag)) {
Message packet = new Message(doc);
packet.setFrom(session.getAddress());
auditor.audit(packet, session);
router.route(packet);
session.incrementClientPacketCount();
}
else if ("presence".equals(tag)) {
Presence packet = new Presence(doc);
packet.setFrom(session.getAddress());
auditor.audit(packet, session);
router.route(packet);
session.incrementClientPacketCount();
// Update the flag that indicates if the user made a clean sign out
clearSignout = (Presence.Type.unavailable == packet.getType() ? true : false);
}
else if ("iq".equals(tag)) {
IQ packet = getIQ(doc);
packet.setFrom(session.getAddress());
auditor.audit(packet, session);
router.route(packet);
session.incrementClientPacketCount();
}
else {
throw new XmlPullParserException(LocaleUtils.getLocalizedString("admin.error.packet.tag") + tag);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment