Commit 62667aa3 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Small refactor

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6024 b35dd754-fafc-0310-a699-88a17e54d16e
parent 29bb43c3
...@@ -65,6 +65,9 @@ public class HttpSession extends ClientSession { ...@@ -65,6 +65,9 @@ public class HttpSession extends ClientSession {
HttpConnection connection = new HttpConnection(rid, isSecure); HttpConnection connection = new HttpConnection(rid, isSecure);
if(rid <= lastRequestID) { if(rid <= lastRequestID) {
Deliverable deliverable = retrieveDeliverable(rid); Deliverable deliverable = retrieveDeliverable(rid);
if (deliverable == null) {
throw new HttpBindException("Unexpected RID Error", true, 404);
}
connection.deliverBody(deliverable.getDeliverable()); connection.deliverBody(deliverable.getDeliverable());
return connection; return connection;
} }
...@@ -82,7 +85,7 @@ public class HttpSession extends ClientSession { ...@@ -82,7 +85,7 @@ public class HttpSession extends ClientSession {
return delivered; return delivered;
} }
} }
throw new HttpBindException("Unexpected RID Error", true, 404); return null;
} }
private void addConnection(HttpConnection connection, boolean isPoll) throws HttpBindException, private void addConnection(HttpConnection connection, boolean isPoll) throws HttpBindException,
...@@ -104,10 +107,15 @@ public class HttpSession extends ClientSession { ...@@ -104,10 +107,15 @@ public class HttpSession extends ClientSession {
connection.setSession(this); connection.setSession(this);
if (pendingElements.size() > 0) { if (pendingElements.size() > 0) {
String deliverable = createDeliverable(pendingElements); String deliverable = createDeliverable(pendingElements);
pendingElements.clear(); try {
fireConnectionOpened(connection); fireConnectionOpened(connection);
deliver(connection, deliverable); deliver(connection, deliverable);
fireConnectionClosed(connection); fireConnectionClosed(connection);
pendingElements.clear();
}
catch (HttpConnectionClosedException he) {
throw he;
}
} }
else { else {
// With this connection we need to check if we will have too many connections open, // With this connection we need to check if we will have too many connections open,
...@@ -192,10 +200,6 @@ public class HttpSession extends ClientSession { ...@@ -192,10 +200,6 @@ public class HttpSession extends ClientSession {
return sb.toString(); return sb.toString();
} }
public InetAddress getInetAddress() {
return null;
}
public synchronized void close() { public synchronized void close() {
conn.close(); conn.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