From: markt Date: Wed, 8 Apr 2009 14:58:20 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46985 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c9db1e3c3fdef4c8dfc85e8cd1014e4a3665449f;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46985 There is still some optimisation possible but I think this is a good balance between clarity and oprimisation. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@763262 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index 6e04cc7e4..d629b070c 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -734,7 +734,7 @@ public class Http11Processor implements ActionHook { * responses * @throws IOException error during an I/O operation */ - public void process(Socket socket) + public void process(Socket theSocket) throws IOException { RequestInfo rp = request.getRequestProcessor(); rp.setStage(org.apache.coyote.Constants.STAGE_PARSE); @@ -748,7 +748,7 @@ public class Http11Processor implements ActionHook { localPort = -1; // Setting up the I/O - this.socket = socket; + this.socket = theSocket; inputBuffer.setInputStream(socket.getInputStream()); outputBuffer.setOutputStream(socket.getOutputStream()); @@ -757,8 +757,7 @@ public class Http11Processor implements ActionHook { keepAlive = true; int keepAliveLeft = maxKeepAliveRequests; - int soTimeout = socket.getSoTimeout(); - int oldSoTimeout = soTimeout; + int soTimeout = endpoint.getSoTimeout(); int threadRatio = (endpoint.getCurrentThreadsBusy() * 100) / endpoint.getMaxThreads(); @@ -766,13 +765,11 @@ public class Http11Processor implements ActionHook { keepAliveLeft = 1; } - if (soTimeout != oldSoTimeout) { - try { - socket.setSoTimeout(soTimeout); - } catch (Throwable t) { - log.debug(sm.getString("http11processor.socket.timeout"), t); - error = true; - } + try { + socket.setSoTimeout(soTimeout); + } catch (Throwable t) { + log.debug(sm.getString("http11processor.socket.timeout"), t); + error = true; } boolean keptAlive = false; @@ -792,7 +789,9 @@ public class Http11Processor implements ActionHook { inputBuffer.parseRequestLine(); request.setStartTime(System.currentTimeMillis()); keptAlive = true; - if (!disableUploadTimeout) { + if (disableUploadTimeout) { + socket.setSoTimeout(soTimeout); + } else { socket.setSoTimeout(timeout); } inputBuffer.parseHeaders();