socket.getIOChannel().socket().setSoTimeout((int)soTimeout);
}
if (!inputBuffer.parseRequestLine(keptAlive)) {
- //no data available yet, since we might have read part
- //of the request line, we can't recycle the processor
+ // Haven't finished reading the request so keep the socket
+ // open
openSocket = true;
- recycle = false;
+ // Check to see if we have read any of the request line yet
if (inputBuffer.getParsingRequestLinePhase()<2) {
- //keep alive timeout here
+ // No data read, OK to recycle the processor
+ // Continue to use keep alive timeout
if (keepAliveTimeout>0) ka.setTimeout(keepAliveTimeout);
+ } else {
+ // Started to read request line. Need to keep processor
+ // associated with socket
+ recycle = false;
}
break;
}
SocketState state = processor.process(socket);
if (state == SocketState.LONG) {
- // Associate the connection with the processor. The next request
- // processed by this thread will use either a new or a recycled
- // processor.
- //if (log.isDebugEnabled()) log.debug("Not recycling ["+processor+"] Comet="+((NioEndpoint.KeyAttachment)socket.getAttachment(false)).getComet());
+ // In the middle of processing a request/response. Keep the
+ // socket associated with the processor.
connections.put(socket, processor);
if (processor.comet) {
NioEndpoint.KeyAttachment att = (NioEndpoint.KeyAttachment)socket.getAttachment(false);
att.setAsync(true);
} else {
- //we should not hold on to the processor objects
- release(socket);
socket.getPoller().add(socket);
}
+ } else if (state == SocketState.OPEN){
+ // In keep-alive but between requests. OK to recycle
+ // processor. Continue to poll for the next request.
+ socket.getPoller().add(socket);
+ recycledProcessors.offer(processor);
} else {
+ // Connection closed. OK to recycle the processor.
recycledProcessors.offer(processor);
}
return state;
Follow up to <bug>48545</bug>. Make JSSE connectors more tolerant of a
incorrect trust store password. (markt)
</add>
+ <fix>
+ Fix some edge cases in the NIO connector when handling requests that are
+ not received all at the same time and the socket needs to be returned to
+ the poller. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">