Commit c0ad2cdd authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Close all connections on an error.

Warn about invalid RIDs in the logs

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6631 b35dd754-fafc-0310-a699-88a17e54d16e
parent 949949e9
...@@ -22,6 +22,7 @@ import org.jivesoftware.wildfire.auth.UnauthorizedException; ...@@ -22,6 +22,7 @@ import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.jivesoftware.wildfire.net.SASLAuthentication; import org.jivesoftware.wildfire.net.SASLAuthentication;
import org.jivesoftware.wildfire.net.VirtualConnection; import org.jivesoftware.wildfire.net.VirtualConnection;
import org.jivesoftware.wildfire.session.ClientSession; import org.jivesoftware.wildfire.session.ClientSession;
import org.jivesoftware.util.Log;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
...@@ -69,12 +70,15 @@ public class HttpSession extends ClientSession { ...@@ -69,12 +70,15 @@ public class HttpSession extends ClientSession {
if(rid <= lastRequestID) { if(rid <= lastRequestID) {
Deliverable deliverable = retrieveDeliverable(rid); Deliverable deliverable = retrieveDeliverable(rid);
if (deliverable == null) { if (deliverable == null) {
Log.warn("Deliverable unavailable for " + rid);
throw new HttpBindException("Unexpected RID Error", true, 404); throw new HttpBindException("Unexpected RID Error", true, 404);
} }
connection.deliverBody(deliverable.getDeliverable()); connection.deliverBody(deliverable.getDeliverable());
return connection; return connection;
} }
else if (rid > lastRequestID + hold + 1) { else if (rid > (lastRequestID + hold)) {
// TODO handle the case of greater RID which basically has it wait
Log.warn("Request " + rid + " > " + (lastRequestID + hold) + ", ending session.");
throw new HttpBindException("Unexpected RID Error", true, 404); throw new HttpBindException("Unexpected RID Error", true, 404);
} }
...@@ -217,6 +221,12 @@ public class HttpSession extends ClientSession { ...@@ -217,6 +221,12 @@ public class HttpSession extends ClientSession {
failDelivery(); failDelivery();
} }
while (connectionQueue.size() > 0) {
HttpConnection toClose = connectionQueue.remove();
toClose.close();
fireConnectionClosed(toClose);
}
for(SessionListener listener : listeners) { for(SessionListener listener : listeners) {
listener.sessionClosed(this); listener.sessionClosed(this);
} }
......
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