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

Recovering undelivered packets from connections when the session is closed. JM-971

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@7061 b35dd754-fafc-0310-a699-88a17e54d16e
parent 52fa91b1
...@@ -546,7 +546,8 @@ public class SessionManager extends BasicModule { ...@@ -546,7 +546,8 @@ public class SessionManager extends BasicModule {
if (serverName == null) { if (serverName == null) {
throw new UnauthorizedException("Server not initialized"); throw new UnauthorizedException("Server not initialized");
} }
HttpSession session = new HttpSession(serverName, address, id, rid); PacketDeliverer backupDeliverer = XMPPServer.getInstance().getPacketDeliverer();
HttpSession session = new HttpSession(backupDeliverer, serverName, address, id, rid);
Connection conn = session.getConnection(); Connection conn = session.getConnection();
conn.init(session); conn.init(session);
conn.registerCloseListener(clientSessionListener, session); conn.registerCloseListener(clientSessionListener, session);
......
...@@ -27,6 +27,7 @@ public class HttpConnection { ...@@ -27,6 +27,7 @@ public class HttpConnection {
private Continuation continuation; private Continuation continuation;
private boolean isClosed; private boolean isClosed;
private boolean isSecure = false; private boolean isSecure = false;
private boolean isDelivered;
/** /**
* Constructs an HTTP Connection. * Constructs an HTTP Connection.
...@@ -37,6 +38,7 @@ public class HttpConnection { ...@@ -37,6 +38,7 @@ public class HttpConnection {
public HttpConnection(long requestId, boolean isSecure) { public HttpConnection(long requestId, boolean isSecure) {
this.requestId = requestId; this.requestId = requestId;
this.isSecure = isSecure; this.isSecure = isSecure;
this.isDelivered = false;
} }
/** /**
...@@ -74,6 +76,10 @@ public class HttpConnection { ...@@ -74,6 +76,10 @@ public class HttpConnection {
return isSecure; return isSecure;
} }
public boolean isDelivered() {
return isDelivered;
}
/** /**
* Delivers content to the client. The content should be valid XMPP wrapped inside of a body. * Delivers content to the client. The content should be valid XMPP wrapped inside of a body.
* A <i>null</i> value for body indicates that the connection should be closed and the client * A <i>null</i> value for body indicates that the connection should be closed and the client
...@@ -162,11 +168,13 @@ public class HttpConnection { ...@@ -162,11 +168,13 @@ public class HttpConnection {
if (continuation.suspend(session.getWait() * 1000)) { if (continuation.suspend(session.getWait() * 1000)) {
String deliverable = (String) continuation.getObject(); String deliverable = (String) continuation.getObject();
// This will occur when the hold attribute of a session has been exceded. // This will occur when the hold attribute of a session has been exceded.
this.isDelivered = true;
if (deliverable == null) { if (deliverable == null) {
throw new HttpBindTimeoutException(); throw new HttpBindTimeoutException();
} }
return deliverable; return deliverable;
} }
this.isDelivered = true;
throw new HttpBindTimeoutException("Request " + requestId + " exceded response time from " + throw new HttpBindTimeoutException("Request " + requestId + " exceded response time from " +
"server of " + session.getWait() + " seconds."); "server of " + session.getWait() + " seconds.");
} }
......
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