From c6b602ac4bd155028688964bbf2f6f417faf73c3 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 28 Jul 2010 22:55:08 +0000 Subject: [PATCH] Fix a failing test with the APR connector. Handle async requests that timeout. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@980260 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/coyote/http11/Http11AprProtocol.java | 65 +++++++++++----------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11AprProtocol.java b/java/org/apache/coyote/http11/Http11AprProtocol.java index 5b782e5df..835a46377 100644 --- a/java/org/apache/coyote/http11/Http11AprProtocol.java +++ b/java/org/apache/coyote/http11/Http11AprProtocol.java @@ -526,39 +526,42 @@ public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration { SocketState state = SocketState.CLOSED; if (result != null) { - // Call the appropriate event - try { - state = result.event(status); - } catch (java.net.SocketException e) { - // SocketExceptions are normal - Http11AprProtocol.log.debug - (sm.getString - ("http11protocol.proto.socketexception.debug"), e); - } catch (java.io.IOException e) { - // IOExceptions are normal - Http11AprProtocol.log.debug - (sm.getString - ("http11protocol.proto.ioexception.debug"), e); - } - // Future developers: if you discover any other - // rare-but-nonfatal exceptions, catch them here, and log as - // above. - catch (Throwable e) { - // any other exception or error is odd. Here we log it - // with "ERROR" level, so it will show up even on - // less-than-verbose logs. - Http11AprProtocol.log.error - (sm.getString("http11protocol.proto.error"), e); - } finally { - if (state != SocketState.LONG) { - connections.remove(Long.valueOf(socket)); - recycledProcessors.offer(result); - if (state == SocketState.OPEN) { - proto.endpoint.getPoller().add(socket); + if (result.comet) { + // Call the appropriate event + try { + state = result.event(status); + } catch (java.net.SocketException e) { + // SocketExceptions are normal + Http11AprProtocol.log.debug(sm.getString( + "http11protocol.proto.socketexception.debug"), + e); + } catch (java.io.IOException e) { + // IOExceptions are normal + Http11AprProtocol.log.debug(sm.getString( + "http11protocol.proto.ioexception.debug"), e); + } + // Future developers: if you discover any other + // rare-but-nonfatal exceptions, catch them here, and log as + // above. + catch (Throwable e) { + // any other exception or error is odd. Here we log it + // with "ERROR" level, so it will show up even on + // less-than-verbose logs. + Http11AprProtocol.log.error(sm.getString( + "http11protocol.proto.error"), e); + } finally { + if (state != SocketState.LONG) { + connections.remove(Long.valueOf(socket)); + recycledProcessors.offer(result); + if (state == SocketState.OPEN) { + proto.endpoint.getPoller().add(socket); + } + } else { + proto.endpoint.getCometPoller().add(socket); } - } else { - proto.endpoint.getCometPoller().add(socket); } + } else if (result.async) { + state = asyncDispatch(socket, status); } } return state; -- 2.11.0