Commit 6248897a authored by huni's avatar huni

Fixed the issue where terminate, pause and xmpp:restart requests were considered polling.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/gsoc@10711 b35dd754-fafc-0310-a699-88a17e54d16e
parent e28c2ad5
......@@ -649,7 +649,7 @@ public class HttpSession extends LocalClientSession {
* protocol.
*/
synchronized HttpConnection createConnection(long rid, Collection<Element> packetsToBeSent,
boolean isSecure)
boolean isSecure, boolean isPoll)
throws HttpConnectionClosedException, HttpBindException
{
HttpConnection connection = new HttpConnection(rid, isSecure, sslCertificates);
......@@ -672,7 +672,7 @@ public class HttpSession extends LocalClientSession {
if (packetsToBeSent.size() > 0) {
packetsToSend.add(packetsToBeSent);
}
addConnection(connection, packetsToBeSent.size() <= 0);
addConnection(connection, isPoll);
return connection;
}
......@@ -806,9 +806,9 @@ public class HttpSession extends LocalClientSession {
overactivity = (pendingConnections >= maxRequests - 1);
}
}
lastPoll = time;
errorMessage += ", minimum polling interval is "
+ maxPollingInterval + ", current interval " + ((time - lastPoll) / 1000);
lastPoll = time;
}
setLastResponseEmpty(false);
......
......@@ -14,6 +14,7 @@ package org.jivesoftware.openfire.http;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.QName;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.StreamID;
import org.jivesoftware.openfire.auth.UnauthorizedException;
......@@ -266,7 +267,14 @@ public class HttpSessionManager {
{
//noinspection unchecked
List<Element> elements = rootNode.elements();
HttpConnection connection = session.createConnection(rid, elements, isSecure);
boolean isPoll = (elements.size() == 0);
if ("terminate".equals(rootNode.attributeValue("type")))
isPoll = false;
if ("true".equals(rootNode.attributeValue(new QName("restart", rootNode.getNamespaceForPrefix("xmpp")))))
isPoll = false;
if (rootNode.attributeValue("pause") != null)
isPoll = false;
HttpConnection connection = session.createConnection(rid, elements, isSecure, isPoll);
if (elements.size() > 0) {
// creates the runnable to forward the packets
new HttpPacketSender(session).init();
......
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