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

Initial work on handling out of order requests

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6752 b35dd754-fafc-0310-a699-88a17e54d16e
parent a4ba1587
...@@ -540,13 +540,13 @@ public class SessionManager extends BasicModule { ...@@ -540,13 +540,13 @@ public class SessionManager extends BasicModule {
return session; return session;
} }
public HttpSession createClientHttpSession(long rid, InetAddress address, StreamID id) public HttpSession createClientHttpSession(long rid, InetAddress address, StreamID id, int hold)
throws UnauthorizedException throws UnauthorizedException
{ {
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); HttpSession session = new HttpSession(serverName, address, id, rid, hold);
Connection conn = session.getConnection(); Connection conn = session.getConnection();
conn.init(session); conn.init(session);
conn.registerCloseListener(clientSessionListener, session); conn.registerCloseListener(clientSessionListener, session);
......
...@@ -118,6 +118,7 @@ public class HttpConnection { ...@@ -118,6 +118,7 @@ public class HttpConnection {
} }
catch (HttpBindTimeoutException e) { catch (HttpBindTimeoutException e) {
this.isClosed = true; this.isClosed = true;
session.closeConnection(this);
throw e; throw e;
} }
} }
......
...@@ -114,9 +114,8 @@ public class HttpSessionManager { ...@@ -114,9 +114,8 @@ public class HttpSessionManager {
int wait = getIntAttribute(rootNode.attributeValue("wait"), 60); int wait = getIntAttribute(rootNode.attributeValue("wait"), 60);
int hold = getIntAttribute(rootNode.attributeValue("hold"), 1); int hold = getIntAttribute(rootNode.attributeValue("hold"), 1);
HttpSession session = createSession(connection.getRequestId(), address); HttpSession session = createSession(connection.getRequestId(), address, hold);
session.setWait(Math.min(wait, getMaxWait())); session.setWait(Math.min(wait, getMaxWait()));
session.setHold(hold);
session.setSecure(connection.isSecure()); session.setSecure(connection.isSecure());
session.setMaxPollingInterval(getPollingInterval()); session.setMaxPollingInterval(getPollingInterval());
session.setMaxRequests(getMaxRequests()); session.setMaxRequests(getMaxRequests());
...@@ -234,11 +233,13 @@ public class HttpSessionManager { ...@@ -234,11 +233,13 @@ public class HttpSessionManager {
return connection; return connection;
} }
private HttpSession createSession(long rid, InetAddress address) throws UnauthorizedException { private HttpSession createSession(long rid, InetAddress address, int hold)
throws UnauthorizedException
{
// Create a ClientSession for this user. // Create a ClientSession for this user.
StreamID streamID = SessionManager.getInstance().nextStreamID(); StreamID streamID = SessionManager.getInstance().nextStreamID();
// Send to the server that a new client session has been created // Send to the server that a new client session has been created
HttpSession session = sessionManager.createClientHttpSession(rid, address, streamID); HttpSession session = sessionManager.createClientHttpSession(rid, address, streamID, hold);
// Register that the new session is associated with the specified stream ID // Register that the new session is associated with the specified stream ID
sessionMap.put(streamID.getID(), session); sessionMap.put(streamID.getID(), session);
session.addSessionCloseListener(sessionListener); session.addSessionCloseListener(sessionListener);
......
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