Commit cdcd1251 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Send end of stream before tagging session as closed. JM-1154

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9348 b35dd754-fafc-0310-a699-88a17e54d16e
parent d3c4c137
...@@ -33,8 +33,8 @@ import org.xmpp.packet.Packet; ...@@ -33,8 +33,8 @@ import org.xmpp.packet.Packet;
import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
...@@ -147,14 +147,14 @@ public class NIOConnection implements Connection { ...@@ -147,14 +147,14 @@ public class NIOConnection implements Connection {
boolean closedSuccessfully = false; boolean closedSuccessfully = false;
synchronized (this) { synchronized (this) {
if (!isClosed()) { if (!isClosed()) {
if (session != null) {
session.setStatus(Session.STATUS_CLOSED);
}
try { try {
deliverRawText(flashClient ? "</flash:stream>" : "</stream:stream>", false); deliverRawText(flashClient ? "</flash:stream>" : "</stream:stream>", false);
} catch (Exception e) { } catch (Exception e) {
// Ignore // Ignore
} }
if (session != null) {
session.setStatus(Session.STATUS_CLOSED);
}
ioSession.close(); ioSession.close();
closed = true; closed = true;
closedSuccessfully = true; closedSuccessfully = true;
...@@ -271,7 +271,8 @@ public class NIOConnection implements Connection { ...@@ -271,7 +271,8 @@ public class NIOConnection implements Connection {
Log.debug("Error delivering raw text" + "\n" + this.toString(), e); Log.debug("Error delivering raw text" + "\n" + this.toString(), e);
errorDelivering = true; errorDelivering = true;
} }
if (errorDelivering) { // Close the connection if delivering text fails and we are already not closing the connection
if (errorDelivering && asynchronous) {
close(); close();
} }
} }
......
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