tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r429003 - /tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
Date Sat, 05 Aug 2006 14:18:48 GMT
Author: remm
Date: Sat Aug  5 07:18:48 2006
New Revision: 429003

URL: http://svn.apache.org/viewvc?rev=429003&view=rev
Log:
- Similar fix of the bad translation of the algorithm.

Modified:
    tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=429003&r1=429002&r2=429003&view=diff
==============================================================================
--- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/net/AprEndpoint.java Sat Aug
 5 07:18:48 2006
@@ -998,16 +998,9 @@
 
                 try {
                     // Allocate a new worker thread
-                    Worker workerThread = getWorkerThread();
                     // Accept the next incoming connection from the server socket
-                    long socket = Socket.accept(serverSock);
                     // Hand this socket off to an appropriate processor
-                    if (setSocketOptions(socket)) {
-                        workerThread.assign(socket);
-                    } else {
-                        // Close socket and pool right away
-                        Socket.destroy(socket);
-                    }
+                    getWorkerThread().assign(Socket.accept(serverSock), true);
                 } catch (Throwable t) {
                     log.error(sm.getString("endpoint.accept.fail"), t);
                 }
@@ -1166,7 +1159,7 @@
                                 continue;
                             }
                             // Hand this socket off to a worker
-                            getWorkerThread().assign(desc[n*2+1]);
+                            getWorkerThread().assign(desc[n*2+1], false);
                         }
                     } else if (rv < 0) {
                         int errn = -rv;
@@ -1218,6 +1211,7 @@
         protected Thread thread = null;
         protected boolean available = false;
         protected long socket = 0;
+        protected boolean options = false;
 
 
         /**
@@ -1229,7 +1223,7 @@
          *
          * @param socket TCP socket to process
          */
-        protected synchronized void assign(long socket) {
+        protected synchronized void assign(long socket, boolean options) {
 
             // Wait for the Processor to get the previous Socket
             while (available) {
@@ -1241,6 +1235,7 @@
 
             // Store the newly available Socket and notify our thread
             this.socket = socket;
+            this.options = options;
             available = true;
             notifyAll();
 
@@ -1286,7 +1281,7 @@
                     continue;
 
                 // Process the request from this socket
-                if (!handler.process(socket)) {
+                if ((options && !setSocketOptions(socket)) || !handler.process(socket))
{
                     // Close socket and pool
                     Socket.destroy(socket);
                     socket = 0;
@@ -1552,7 +1547,7 @@
                                     Socket.timeoutSet(state.socket, soTimeout * 1000);
                                     // If all done hand this socket off to a worker for
                                     // processing of further requests
-                                    getWorkerThread().assign(state.socket);
+                                    getWorkerThread().assign(state.socket, false);
                                 } else {
                                     // Close the socket since this is
                                     // the end of not keep-alive request.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message