cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java Http11Processor.java

2005-07-30 Thread markt
markt   2005/07/30 09:18:14

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java Http11Processor.java
  Log:
  Fix typo. Should also fix Gump.
  
  Revision  ChangesPath
  1.29  +1 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Http11AprProcessor.java   29 Jul 2005 10:23:56 -  1.28
  +++ Http11AprProcessor.java   30 Jul 2005 16:18:14 -  1.29
  @@ -34,7 +34,7 @@
   import org.apache.coyote.Request;
   import org.apache.coyote.RequestInfo;
   import org.apache.coyote.Response;
  -import org.apache.coyote.ajp.Constants;
  +import org.apache.coyote.http11.Constants;
   import org.apache.coyote.http11.filters.ChunkedInputFilter;
   import org.apache.coyote.http11.filters.ChunkedOutputFilter;
   import org.apache.coyote.http11.filters.GzipOutputFilter;
  
  
  
  1.123 +1 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- Http11Processor.java  29 Jul 2005 10:23:56 -  1.122
  +++ Http11Processor.java  30 Jul 2005 16:18:14 -  1.123
  @@ -35,7 +35,7 @@
   import org.apache.coyote.Request;
   import org.apache.coyote.RequestInfo;
   import org.apache.coyote.Response;
  -import org.apache.coyote.ajp.Constants;
  +import org.apache.coyote.http11.Constants;
   import org.apache.coyote.http11.filters.ChunkedInputFilter;
   import org.apache.coyote.http11.filters.ChunkedOutputFilter;
   import org.apache.coyote.http11.filters.GzipOutputFilter;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-13 Thread remm
remm2005/07/13 04:05:20

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Fix array length if no client certs.
  
  Revision  ChangesPath
  1.24  +22 -25
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Http11AprProcessor.java   12 Jul 2005 17:01:42 -  1.23
  +++ Http11AprProcessor.java   13 Jul 2005 11:05:19 -  1.24
  @@ -1085,22 +1085,20 @@
   request.setAttribute
   (javax.servlet.request.cipher_suite, sslO);
   int certLength = SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN);
  -X509Certificate[] certs = new 
X509Certificate[certLength];
  -for (int i = 0; i  certLength; i++) {
  -byte[] data = SSLSocket.getInfoB(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
  -CertificateFactory cf =
  -CertificateFactory.getInstance(X.509);
  -ByteArrayInputStream stream = new 
ByteArrayInputStream(data);
  -certs[i] = (X509Certificate) 
cf.generateCertificate(stream);
  -}
  +X509Certificate[] certs = null;
   if (certLength  0) {
  -sslO = certs;
  -} else {
  -sslO = null;
  +certs = new X509Certificate[certLength];
  +for (int i = 0; i  certLength; i++) {
  +byte[] data = SSLSocket.getInfoB(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
  +CertificateFactory cf =
  +CertificateFactory.getInstance(X.509);
  +ByteArrayInputStream stream = new 
ByteArrayInputStream(data);
  +certs[i] = (X509Certificate) 
cf.generateCertificate(stream);
  +}
   }
  -if (sslO != null)
  +if (certs != null)
   request.setAttribute
  -(javax.servlet.request.X509Certificate, sslO);
  +(javax.servlet.request.X509Certificate, certs);
   sslO = new Integer(SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CIPHER_USEKEYSIZE));
   if (sslO != null)
   request.setAttribute
  @@ -1130,21 +1128,20 @@
   // FIXME: Verify this is the right thing to do
   SSLSocket.renegotiate(socket);
   int certLength = SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN);
  -X509Certificate[] certs = new 
X509Certificate[certLength];
  -for (int i = 0; i  certLength; i++) {
  -byte[] data = SSLSocket.getInfoB(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
  -CertificateFactory cf =
  -CertificateFactory.getInstance(X.509);
  -ByteArrayInputStream stream = new 
ByteArrayInputStream(data);
  -certs[i] = (X509Certificate) 
cf.generateCertificate(stream);
  -}
  -Object sslO = null;
  +X509Certificate[] certs = null;
   if (certLength  0) {
  -sslO = certs;
  +certs = new X509Certificate[certLength];
  +for (int i = 0; i  certLength; i++) {
  +byte[] data = SSLSocket.getInfoB(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
  +CertificateFactory cf =
  +CertificateFactory.getInstance(X.509);
  +ByteArrayInputStream stream = new 
ByteArrayInputStream(data);
  +certs[i] = (X509Certificate) 
cf.generateCertificate(stream);
  +}
   }
  -if (sslO != null)
  +if (certs != null)
   request.setAttribute
  -(javax.servlet.request.X509Certificate, sslO);
  +(javax.servlet.request.X509Certificate, certs);
   } catch (Exception e) {
   log.warn(Exception getting SSL Cert, e);
   }
  
  
  


cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-13 Thread remm
remm2005/07/13 06:03:51

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Code cleanups and comments.
  
  Revision  ChangesPath
  1.25  +18 -10
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Http11AprProcessor.java   13 Jul 2005 11:05:19 -  1.24
  +++ Http11AprProcessor.java   13 Jul 2005 13:03:51 -  1.25
  @@ -1080,10 +1080,13 @@
   
   try {
   if (ssl) {
  +// Cipher suite
   Object sslO = SSLSocket.getInfoS(socket, 
SSL.SSL_INFO_CIPHER);
  -if (sslO != null)
  +if (sslO != null) {
   request.setAttribute
   (javax.servlet.request.cipher_suite, sslO);
  +}
  +// Client certificate chain if present
   int certLength = SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN);
   X509Certificate[] certs = null;
   if (certLength  0) {
  @@ -1096,17 +1099,22 @@
   certs[i] = (X509Certificate) 
cf.generateCertificate(stream);
   }
   }
  -if (certs != null)
  +if (certs != null) {
   request.setAttribute
   (javax.servlet.request.X509Certificate, certs);
  +}
  +// User key size
   sslO = new Integer(SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CIPHER_USEKEYSIZE));
  -if (sslO != null)
  +if (sslO != null) {
   request.setAttribute
   (javax.servlet.request.key_size, sslO);
  +}
  +// SSL session ID
   sslO = SSLSocket.getInfoS(socket, 
SSL.SSL_INFO_SESSION_ID);
  -if (sslO != null)
  +if (sslO != null) {
   request.setAttribute
   (javax.servlet.request.ssl_session, sslO);
  +}
   }
   } catch (Exception e) {
   log.warn(Exception getting SSL attributes  ,e);
  @@ -1115,18 +1123,17 @@
   } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
   
   if (ssl) {
  -/*
  - * Consume and buffer the request body, so that it does not
  - * interfere with the client's handshake messages
  - */
  + // Consume and buffer the request body, so that it does not
  + // interfere with the client's handshake messages
   InputFilter[] inputFilters = inputBuffer.getFilters();
   ((BufferedInputFilter) 
inputFilters[Constants.BUFFERED_FILTER])
   .setLimit(maxSavePostSize);
   inputBuffer.addActiveFilter
   (inputFilters[Constants.BUFFERED_FILTER]);
   try {
  -// FIXME: Verify this is the right thing to do
  +// Renegociate certificates
   SSLSocket.renegotiate(socket);
  +// Client certificate chain if present
   int certLength = SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN);
   X509Certificate[] certs = null;
   if (certLength  0) {
  @@ -1139,9 +1146,10 @@
   certs[i] = (X509Certificate) 
cf.generateCertificate(stream);
   }
   }
  -if (certs != null)
  +if (certs != null) {
   request.setAttribute
   (javax.servlet.request.X509Certificate, certs);
  +}
   } catch (Exception e) {
   log.warn(Exception getting SSL Cert, e);
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-12 Thread remm
remm2005/07/12 10:01:42

  Modified:jni/java/org/apache/tomcat/jni SSLSocket.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Translate old SSL code to APR (untested right now).
  
  Revision  ChangesPath
  1.18  +1 -4  
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java
  
  Index: SSLSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLSocket.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SSLSocket.java12 Jul 2005 14:56:09 -  1.17
  +++ SSLSocket.java12 Jul 2005 17:01:42 -  1.18
  @@ -16,9 +16,6 @@
   
   package org.apache.tomcat.jni;
   
  -/* Import needed classes */
  -import java.nio.ByteBuffer;
  -
   /** SSL Socket
*
* @author Mladen Turk
  
  
  
  1.23  +52 -31
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Http11AprProcessor.java   7 Jul 2005 22:54:13 -   1.22
  +++ Http11AprProcessor.java   12 Jul 2005 17:01:42 -  1.23
  @@ -16,6 +16,7 @@
   
   package org.apache.coyote.http11;
   
  +import java.io.ByteArrayInputStream;
   import java.io.IOException;
   import java.io.InterruptedIOException;
   import java.net.InetAddress;
  @@ -24,6 +25,8 @@
   import java.util.regex.PatternSyntaxException;
   import java.security.AccessController;
   import java.security.PrivilegedAction;
  +import java.security.cert.CertificateFactory;
  +import java.security.cert.X509Certificate;
   
   import org.apache.coyote.ActionCode;
   import org.apache.coyote.ActionHook;
  @@ -41,6 +44,8 @@
   import org.apache.coyote.http11.filters.VoidOutputFilter;
   import org.apache.coyote.http11.filters.BufferedInputFilter;
   import org.apache.tomcat.jni.Address;
  +import org.apache.tomcat.jni.SSL;
  +import org.apache.tomcat.jni.SSLSocket;
   import org.apache.tomcat.jni.Sockaddr;
   import org.apache.tomcat.jni.Socket;
   import org.apache.tomcat.util.buf.Ascii;
  @@ -50,7 +55,6 @@
   import org.apache.tomcat.util.http.FastHttpDateFormat;
   import org.apache.tomcat.util.http.MimeHeaders;
   import org.apache.tomcat.util.net.AprEndpoint;
  -import org.apache.tomcat.util.net.SSLSupport;
   import org.apache.tomcat.util.threads.ThreadWithAttributes;
   
   
  @@ -90,6 +94,8 @@
   outputBuffer = new InternalAprOutputBuffer(response, 
headerBufferSize);
   response.setOutputBuffer(outputBuffer);
   request.setResponse(response);
  +
  +ssl = !off.equalsIgnoreCase(endpoint.getSSLEngine());
   
   initializeFilters();
   
  @@ -194,10 +200,10 @@
   
   
   /**
  - * SSL information.
  + * SSL enabled ?
*/
  -protected SSLSupport sslSupport;
  -
  +protected boolean ssl = false;
  +
   
   /**
* Socket associated with the current connection.
  @@ -645,14 +651,6 @@
   
   
   /**
  - * Set the SSL information for this HTTP connection.
  - */
  -public void setSSLSupport(SSLSupport sslSupport) {
  -this.sslSupport = sslSupport;
  -}
  -
  -
  -/**
* Set the flag to control upload time-outs.
*/
   public void setDisableUploadTimeout(boolean isDisabled) {
  @@ -898,9 +896,6 @@
   inputBuffer.recycle();
   outputBuffer.recycle();
   
  -// Recycle ssl info
  -sslSupport = null;
  -
   return openSocket;
   
   }
  @@ -1084,23 +1079,36 @@
   } else if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
   
   try {
  -if (sslSupport != null) {
  -Object sslO = sslSupport.getCipherSuite();
  +if (ssl) {
  +Object sslO = SSLSocket.getInfoS(socket, 
SSL.SSL_INFO_CIPHER);
   if (sslO != null)
   request.setAttribute
  -(SSLSupport.CIPHER_SUITE_KEY, sslO);
  -sslO = sslSupport.getPeerCertificateChain(false);
  +(javax.servlet.request.cipher_suite, sslO);
  +int certLength = SSLSocket.getInfoI(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN);
  +X509Certificate[] certs = new 
X509Certificate[certLength];
  +for (int i = 0; i  certLength; i++) {
  +byte[] data = SSLSocket.getInfoB(socket, 
SSL.SSL_INFO_CLIENT_CERT_CHAIN + i);
  +CertificateFactory cf =
  +  

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-03 Thread remm
remm2005/07/03 03:12:51

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Small tweaks.
  
  Revision  ChangesPath
  1.57  +1 -3  
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- AprEndpoint.java  3 Jul 2005 00:20:27 -   1.56
  +++ AprEndpoint.java  3 Jul 2005 10:12:51 -   1.57
  @@ -1165,7 +1165,7 @@
   } else {
   data.pos = data.pos + nw;
   if (data.pos = data.end) {
  -// Entire file has been send
  +// Entire file has been sent
   Pool.destroy(data.fdpool);
   // Set back socket to blocking mode
   Socket.timeoutSet(data.socket, soTimeout * 1000);
  @@ -1196,8 +1196,6 @@
   if (rv == Status.APR_SUCCESS) {
   sendfileCount--;
   }
  -// Set the socket to blocking mode again
  -Socket.optSet(data.socket, Socket.APR_SO_NONBLOCK, 0);
   sendfileData.remove(data);
   }
   
  
  
  
  1.21  +0 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Http11AprProcessor.java   3 Jul 2005 00:20:27 -   1.20
  +++ Http11AprProcessor.java   3 Jul 2005 10:12:51 -   1.21
  @@ -776,7 +776,6 @@
   // This means that no data is available right now
   // (long keepalive), so that the processor should be 
recycled
   // and the method should return true
  -rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
   openSocket = true;
   // Add the socket to the poller
   endpoint.getPoller().add(socket);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-02 Thread remm
remm2005/07/02 10:36:35

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - No change. Remove some tabs.
  
  Revision  ChangesPath
  1.55  +10 -11
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- AprEndpoint.java  2 Jul 2005 17:18:46 -   1.54
  +++ AprEndpoint.java  2 Jul 2005 17:36:34 -   1.55
  @@ -1283,17 +1283,16 @@
   if (state.pos = state.end) {
   remove(state);
   if (state.keepAlive) {
  - // Destroy file descriptor pool, which 
should close the file
  - Pool.destroy(state.fdpool);
  - 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);
  -}
  -else {
  - // Close the socket since this is
  - // the end of not keep-alive request.
  - Socket.destroy(state.socket);   
  +// Destroy file descriptor pool, which 
should close the file
  +Pool.destroy(state.fdpool);
  +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);
  +} else {
  +// Close the socket since this is
  +// the end of not keep-alive request.
  +Socket.destroy(state.socket);
   }
   }
   }
  
  
  
  1.19  +3 -4  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Http11AprProcessor.java   2 Jul 2005 17:18:46 -   1.18
  +++ Http11AprProcessor.java   2 Jul 2005 17:36:35 -   1.19
  @@ -884,13 +884,12 @@
   // Do sendfile as needed: add socket to sendfile and end
   if (sendfileData != null) {
   sendfileData.socket = socket;
  - sendfileData.keepAlive = keepAlive;
  +sendfileData.keepAlive = keepAlive;
   if (!endpoint.getSendfile().add(sendfileData)) {
   keepAlive = false;
   openSocket = false;
  -}
  -else {
  - openSocket = true;
  +} else {
  +openSocket = true;
   }
   break;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-02 Thread remm
remm2005/07/02 17:20:27

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Hopefully fix the algorithm. The return value is according to the comments.
  - Open socket will be set to true if either the socket was already closed in
sendfile or if it went to the sendfile poller.
  
  Revision  ChangesPath
  1.56  +3 -4  
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- AprEndpoint.java  2 Jul 2005 17:36:34 -   1.55
  +++ AprEndpoint.java  3 Jul 2005 00:20:27 -   1.56
  @@ -1155,9 +1155,8 @@
 data.pos, data.end, 0);
   if (nw  0) {
   if (!(-nw == Status.EAGAIN)) {
  - /* The socket will be destroyed on the
  -  * return from the processSocket call
  -  */
  +Socket.destroy(data.socket);
  +data.socket = 0;
   return false;
   } else {
   // Break the loop and add the socket to poller.
  @@ -1184,7 +1183,7 @@
   addS.add(data);
   addS.notify();
   }
  -return true;
  +return false;
   }
   
   /**
  
  
  
  1.20  +1 -4  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Http11AprProcessor.java   2 Jul 2005 17:36:35 -   1.19
  +++ Http11AprProcessor.java   3 Jul 2005 00:20:27 -   1.20
  @@ -886,12 +886,9 @@
   sendfileData.socket = socket;
   sendfileData.keepAlive = keepAlive;
   if (!endpoint.getSendfile().add(sendfileData)) {
  -keepAlive = false;
  -openSocket = false;
  -} else {
   openSocket = true;
  +break;
   }
  -break;
   }
   
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-02 Thread Natasha Hasmani
Thank-you for your e-mail.

Please note that i will be away from the office starting Wednesday June
29th, returning Thursday July 7th, with no access to email.  In my absence,
kindly contact Cheri Dueck at [EMAIL PROTECTED]

Kind Regards,

Natasha Hasmani
Senior Event Manager 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-07-02 Thread Natasha Hasmani
Thank-you for your e-mail.

Please note that i will be away from the office starting Wednesday June
29th, returning Thursday July 7th, with no access to email.  In my absence,
kindly contact Cheri Dueck at [EMAIL PROTECTED]

Kind Regards,

Natasha Hasmani
Senior Event Manager 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-06-23 Thread remm
remm2005/06/23 04:47:32

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Conserving threads when half are already busy seems better. It's possible a
good value for maxThreads in many scenarios would end up being 40 or
something.
  
  Revision  ChangesPath
  1.17  +1 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Http11AprProcessor.java   17 Jun 2005 12:31:40 -  1.16
  +++ Http11AprProcessor.java   23 Jun 2005 11:47:32 -  1.17
  @@ -758,7 +758,7 @@
   
   int limit = 0;
   if (endpoint.getFirstReadTimeout()  0) {
  -limit = (endpoint.getMaxThreads() * 3) / 4;
  +limit = endpoint.getMaxThreads() / 2;
   }
   
   boolean keptAlive = false;
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-06-17 Thread remm
remm2005/06/17 05:31:40

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Remove useless pool field in SendfileData.
  
  Revision  ChangesPath
  1.47  +3 -4  
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- AprEndpoint.java  17 Jun 2005 09:43:35 -  1.46
  +++ AprEndpoint.java  17 Jun 2005 12:31:40 -  1.47
  @@ -1065,7 +1065,6 @@
   public long end;
   // Socket and socket pool
   public long socket;
  -public long pool;
   // Position
   public long pos;
   }
  @@ -1246,7 +1245,7 @@
   } else {
   
log.warn(sm.getString(endpoint.sendfile.addfail,  + rv));
   // Can't do anything: close the socket 
right away
  -Pool.destroy(data.pool);
  +Socket.destroy(data.socket);
   }
   }
   addS.clear();
  @@ -1267,7 +1266,7 @@
   // Destroy file descriptor pool, which 
should close the file
   Pool.destroy(state.fdpool);
   // Close the socket, as the reponse would be 
incomplete
  -Pool.destroy(state.pool);
  +Socket.destroy(state.socket);
   continue;
   }
   // Write some data using sendfile
  @@ -1279,7 +1278,7 @@
   remove(state);
   // Close the socket, as the reponse would be 
incomplete
   // This will close the file too.
  -Pool.destroy(state.pool);
  +Socket.destroy(state.socket);
   continue;
   }
   
  
  
  
  1.16  +0 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Http11AprProcessor.java   17 Jun 2005 09:43:35 -  1.15
  +++ Http11AprProcessor.java   17 Jun 2005 12:31:40 -  1.16
  @@ -884,7 +884,6 @@
   // Do sendfile as needed: add socket to sendfile and end
   if (sendfileData != null) {
   sendfileData.socket = socket;
  -sendfileData.pool = 0;
   if (!endpoint.getSendfile().add(sendfileData)) {
   keepAlive = false;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-05-26 Thread remm
remm2005/05/26 02:06:16

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Allow using a firstRead value = 0 to specify to always use the poller for
keepalive. The first request processed by the processor will always wait a
little before going back to the poller.
  - Also use 5ms instead of 100ms for pollTime (it doesn't seem to have any
performance impact, or it's just that my computer is fast). 1ms does have a
(very small) performance impact, however.
  
  Revision  ChangesPath
  1.31  +1 -1  
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AprEndpoint.java  23 May 2005 06:04:02 -  1.30
  +++ AprEndpoint.java  26 May 2005 09:06:16 -  1.31
  @@ -255,7 +255,7 @@
* Poll interval, in microseconds. The smaller the value, the more CPU 
the poller
* will use, but the more responsive to activity it will be.
*/
  -protected int pollTime = 10;
  +protected int pollTime = 5000;
   public int getPollTime() { return pollTime; }
   public void setPollTime(int pollTime) { this.pollTime = pollTime; }
   
  
  
  
  1.14  +12 -4 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Http11AprProcessor.java   25 May 2005 12:45:38 -  1.13
  +++ Http11AprProcessor.java   26 May 2005 09:06:16 -  1.14
  @@ -77,8 +77,12 @@
   this.endpoint = endpoint;
   
   request = new Request();
  -inputBuffer = new InternalAprInputBuffer(request, headerBufferSize, 
  -endpoint.getFirstReadTimeout());
  +int readTimeout = endpoint.getFirstReadTimeout();
  +if (readTimeout = 0) {
  +readTimeout = 100;
  +}
  +inputBuffer = new InternalAprInputBuffer(request, headerBufferSize,
  +readTimeout);
   request.setInputBuffer(inputBuffer);
   
   response = new Response();
  @@ -752,7 +756,10 @@
   int keepAliveLeft = maxKeepAliveRequests;
   long soTimeout = endpoint.getSoTimeout();
   
  -int limit = (endpoint.getMaxThreads() * 3) / 4;
  +int limit = 0;
  +if (endpoint.getFirstReadTimeout()  0) {
  +limit = (endpoint.getMaxThreads() * 3) / 4;
  +}
   
   boolean keptAlive = false;
   boolean openSocket = false;
  @@ -764,7 +771,8 @@
   if( !disableUploadTimeout  keptAlive  soTimeout  0 ) {
   Socket.timeoutSet(socket, soTimeout * 1000);
   }
  -if 
(!inputBuffer.parseRequestLine(endpoint.getCurrentThreadsBusy()  limit)) {
  +if (!inputBuffer.parseRequestLine
  +(keptAlive  (endpoint.getCurrentThreadsBusy()  
limit))) {
   // This means that no data is available right now
   // (long keepalive), so that the processor should be 
recycled
   // and the method should return true
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java InternalAprInputBuffer.java

2005-05-25 Thread remm
remm2005/05/25 05:45:38

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java InternalAprInputBuffer.java
  Log:
  - If the thread count gets too high, don't do any blocking read to start off
the request if no data is available, and put the socket in the poller.
  
  Revision  ChangesPath
  1.13  +3 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Http11AprProcessor.java   22 May 2005 17:12:11 -  1.12
  +++ Http11AprProcessor.java   25 May 2005 12:45:38 -  1.13
  @@ -751,6 +751,8 @@
   
   int keepAliveLeft = maxKeepAliveRequests;
   long soTimeout = endpoint.getSoTimeout();
  +
  +int limit = (endpoint.getMaxThreads() * 3) / 4;
   
   boolean keptAlive = false;
   boolean openSocket = false;
  @@ -762,7 +764,7 @@
   if( !disableUploadTimeout  keptAlive  soTimeout  0 ) {
   Socket.timeoutSet(socket, soTimeout * 1000);
   }
  -if (!inputBuffer.parseRequestLine()) {
  +if 
(!inputBuffer.parseRequestLine(endpoint.getCurrentThreadsBusy()  limit)) {
   // This means that no data is available right now
   // (long keepalive), so that the processor should be 
recycled
   // and the method should return true
  
  
  
  1.7   +7 -1  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
  
  Index: InternalAprInputBuffer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InternalAprInputBuffer.java   15 May 2005 15:49:31 -  1.6
  +++ InternalAprInputBuffer.java   25 May 2005 12:45:38 -  1.7
  @@ -386,7 +386,7 @@
* @return true if data is properly fed; false if no data is available 
* immediately and thread should be freed
*/
  -public boolean parseRequestLine()
  +public boolean parseRequestLine(boolean useAvailableData)
   throws IOException {
   
   int start = 0;
  @@ -400,6 +400,9 @@
   
   // Read new bytes if needed
   if (pos = lastValid) {
  +if (useAvailableData) {
  +return false;
  +}
   // Do a simple read with a short timeout
   bbuf.clear();
   int nRead = Socket.recvbt
  @@ -427,6 +430,9 @@
   start = pos;
   
   if (pos = lastValid) {
  +if (useAvailableData) {
  +return false;
  +}
   // Do a simple read with a short timeout
   bbuf.clear();
   int nRead = Socket.recvbt
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java Http11AprProtocol.java Http11Processor.java Http11Protocol.java

2005-05-22 Thread markt
markt   2005/05/22 10:12:11

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java Http11AprProtocol.java
Http11Processor.java Http11Protocol.java
  Log:
  Implement request body replay action.
  Use new maxSavePostSize attribute rather than maxPostSize to control size of 
POST buffered during SSL handshake.
  
  Revision  ChangesPath
  1.12  +17 -7 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Http11AprProcessor.java   11 May 2005 11:23:26 -  1.11
  +++ Http11AprProcessor.java   22 May 2005 17:12:11 -  1.12
  @@ -36,6 +36,7 @@
   import org.apache.coyote.http11.filters.GzipOutputFilter;
   import org.apache.coyote.http11.filters.IdentityInputFilter;
   import org.apache.coyote.http11.filters.IdentityOutputFilter;
  +import org.apache.coyote.http11.filters.SavedRequestInputFilter;
   import org.apache.coyote.http11.filters.VoidInputFilter;
   import org.apache.coyote.http11.filters.VoidOutputFilter;
   import org.apache.coyote.http11.filters.BufferedInputFilter;
  @@ -268,9 +269,9 @@
   
   
   /**
  - * Max post size.
  + * Max save post size.
*/
  -protected int maxPostSize = 2 * 1024 * 1024;
  +protected int maxSavePostSize = 4 * 1024;
   
   
   /**
  @@ -626,16 +627,16 @@
   /**
* Set the maximum size of a POST which will be buffered in SSL mode.
*/
  -public void setMaxPostSize(int mps) {
  -maxPostSize = mps;
  +public void setMaxSavePostSize(int msps) {
  +maxSavePostSize = msps;
   }
   
   
   /**
* Return the maximum size of a POST which will be buffered in SSL mode.
*/
  -public int getMaxPostSize() {
  -return maxPostSize;
  +public int getMaxSavePostSize() {
  +return maxSavePostSize;
   }
   
   
  @@ -1103,7 +1104,7 @@
*/
   InputFilter[] inputFilters = inputBuffer.getFilters();
   ((BufferedInputFilter) 
inputFilters[Constants.BUFFERED_FILTER])
  -.setLimit(maxPostSize);
  +.setLimit(maxSavePostSize);
   inputBuffer.addActiveFilter
   (inputFilters[Constants.BUFFERED_FILTER]);
   try {
  @@ -1115,6 +1116,15 @@
   } catch (Exception e) {
   log.warn(Exception getting SSL Cert, e);
   }
  +} else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
  +ByteChunk body = (ByteChunk) param;
  +
  +InputFilter savedBody = new SavedRequestInputFilter(body);
  +savedBody.setRequest(request);
  +
  +InternalInputBuffer internalBuffer = (InternalInputBuffer)
  +request.getInputBuffer();
  +internalBuffer.addActiveFilter(savedBody);
   }
   }
   
  
  
  
  1.5   +7 -9  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProtocol.java
  
  Index: Http11AprProtocol.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProtocol.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Http11AprProtocol.java20 Apr 2005 16:40:52 -  1.4
  +++ Http11AprProtocol.java22 May 2005 17:12:11 -  1.5
  @@ -35,11 +35,9 @@
   import org.apache.coyote.RequestInfo;
   import org.apache.tomcat.util.net.AprEndpoint;
   import org.apache.tomcat.util.net.SSLImplementation;
  -import org.apache.tomcat.util.net.SSLSupport;
   import org.apache.tomcat.util.net.ServerSocketFactory;
   import org.apache.tomcat.util.net.AprEndpoint.Handler;
   import org.apache.tomcat.util.res.StringManager;
  -import org.apache.tomcat.util.threads.ThreadWithAttributes;
   
   
   /**
  @@ -220,7 +218,7 @@
   
   private int maxKeepAliveRequests=100; // as in Apache HTTPD server
   private int timeout = 30;   // 5 minutes as in Apache HTTPD server
  -private int maxPostSize = 2 * 1024 * 1024;
  +private int maxSavePostSize = 4 * 1024;
   private int maxHttpHeaderSize = 4 * 1024;
   private String reportedname;
   private int socketCloseDelay=-1;
  @@ -361,13 +359,13 @@
   setAttribute(compression, valueS);
   }
   
  -public int getMaxPostSize() {
  -return maxPostSize;
  +public int getMaxSavePostSize() {
  +return maxSavePostSize;
   }
   
  -

Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-05-14 Thread Remy Maucherat
Bill Barker wrote:
Peter's test was stressing my poor little box a lot (which it really 
shouldn't, since it is a high-concurrency/low-traffic test).  It was one 
of the things I wanted to look into when I had time to run more tests.

Also, I've been running the test with sendfile disabled.  It seems that 
Solaris7 doesn't have this particular feature :(It was added to 
Solaris8). With sendfile enabled, I get a nice core-dump (since there is 
no apr_socket_sendfile in my libapr.so :).  I'm guessing that a for 
production release we need something like this in AprEndpoint.init:
  if(useSendfile  !Apr.hasFeature(Apr.SENDFILE)) {
log.warn(disabling sendfile, since your apr version doesn't 
support it);
useSendfile = false;
  }
I didn't know that. Yes, the check is needed then.
He still needs to remove some syncs in the native code, apparently (= 
the hacks he added on top of APR, but which didn't quite work).
It seems I need to look for a few more patches before I can usefully test.
Which changes do you suggest besides fixing sendfile ?
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-05-14 Thread Mladen Turk
Remy Maucherat wrote:
Bill Barker wrote:
  if(useSendfile  !Apr.hasFeature(Apr.SENDFILE)) {
log.warn(disabling sendfile, since your apr version doesn't 
support it);
useSendfile = false;
  }
I didn't know that. Yes, the check is needed then.
Yes seems it's needed.
You already have the :
Library.APR_HAS_SENDFILE boolean, that is meant to be used
for that (checking if the OS supports sendfile).
Regards,
Mladen.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-05-13 Thread Bill Barker

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 11, 2005 4:23 AM
Subject: cvs commit:
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java


 remm2005/05/11 04:23:26

   Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
http11/src/java/org/apache/coyote/http11
 Http11AprProcessor.java
   Log:
   - Should fix thread safety issue reported by Bill (needs testing).

Peter's test case does finish with this on my Solaris box.  I'll see if I
can do more testing next week.



This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-05-13 Thread Remy Maucherat
Bill Barker wrote:
remm2005/05/11 04:23:26
 Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
  http11/src/java/org/apache/coyote/http11
   Http11AprProcessor.java
 Log:
 - Should fix thread safety issue reported by Bill (needs testing).
Peter's test case does finish with this on my Solaris box.  I'll see if I
can do more testing next week.
Mladen told me that the sync was badly done, and that I should be using 
a queue instead (too bad, it took one week).

He still needs to remove some syncs in the native code, apparently (= 
the hacks he added on top of APR, but which didn't quite work).

Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-05-13 Thread Bill Barker
- Original Message - 
From: Remy Maucherat [EMAIL PROTECTED]
To: Tomcat Developers List tomcat-dev@jakarta.apache.org
Sent: Friday, May 13, 2005 9:29 PM
Subject: Re: cvs commit: 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 
Http11AprProcessor.java


Bill Barker wrote:
remm2005/05/11 04:23:26
 Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
  http11/src/java/org/apache/coyote/http11
   Http11AprProcessor.java
 Log:
 - Should fix thread safety issue reported by Bill (needs testing).
Peter's test case does finish with this on my Solaris box.  I'll see if I
can do more testing next week.
Mladen told me that the sync was badly done, and that I should be using a 
queue instead (too bad, it took one week).
Peter's test was stressing my poor little box a lot (which it really 
shouldn't, since it is a high-concurrency/low-traffic test).  It was one of 
the things I wanted to look into when I had time to run more tests.

Also, I've been running the test with sendfile disabled.  It seems that 
Solaris7 doesn't have this particular feature :(It was added to Solaris8). 
With sendfile enabled, I get a nice core-dump (since there is no 
apr_socket_sendfile in my libapr.so :).  I'm guessing that a for production 
release we need something like this in AprEndpoint.init:
  if(useSendfile  !Apr.hasFeature(Apr.SENDFILE)) {
log.warn(disabling sendfile, since your apr version doesn't 
support it);
useSendfile = false;
  }

He still needs to remove some syncs in the native code, apparently (= the 
hacks he added on top of APR, but which didn't quite work).

It seems I need to look for a few more patches before I can usefully test.
Rémy

This message is intended only for the use of the person(s) listed above as 
the intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication 
in error, please notify us immediately by e-mail and then delete all copies of 
this message and any attachments.
In addition you should be aware that ordinary (unencrypted) e-mail sent through 
the Internet is not secure. Do not send confidential or sensitive information, 
such as social security numbers, account numbers, personal identification 
numbers and passwords, to us via ordinary (unencrypted) e-mail.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-05-11 Thread remm
remm2005/05/11 04:23:26

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Should fix thread safety issue reported by Bill (needs testing).
  
  Revision  ChangesPath
  1.25  +63 -32
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AprEndpoint.java  3 May 2005 09:36:58 -   1.24
  +++ AprEndpoint.java  11 May 2005 11:23:26 -  1.25
  @@ -17,6 +17,7 @@
   package org.apache.tomcat.util.net;
   
   import java.net.InetAddress;
  +import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Stack;
   
  @@ -715,6 +716,10 @@
   protected long pool = 0;
   protected long[] desc;
   
  +protected long[] addS;
  +protected long[] addP;
  +protected int addCount = 0;
  +
   protected synchronized void init() {
   pool = Pool.create(serverSockPool);
   try {
  @@ -735,6 +740,8 @@
   }
   desc = new long[pollerSize * 4];
   keepAliveCount = 0;
  +addS = new long[pollerSize];
  +addP = new long[pollerSize];
   }
   
   protected void destroy() {
  @@ -742,23 +749,17 @@
   }
   
   public void add(long socket, long pool) {
  -synchronized (this) {
  -int rv = Poll.add(serverPollset, socket, pool, 
Poll.APR_POLLIN);
  -if (rv == Status.APR_SUCCESS) {
  -keepAliveCount++;
  -} else {
  +synchronized (addS) {
  +// Add socket to the list. Newly added sockets will wait 
  +// at most for pollTime before being polled
  +if (addCount = addS.length) {
   // Can't do anything: close the socket right away
   Pool.destroy(pool);
  +return;
   }
  -}
  -}
  -
  -public void remove(long socket) {
  -synchronized (this) {
  -int rv = Poll.remove(serverPollset, socket);
  -if (rv == Status.APR_SUCCESS) {
  -keepAliveCount--;
  -}
  +addS[addCount] = socket;
  +addP[addCount] = pool;
  +addCount++;
   }
   }
   
  @@ -780,7 +781,7 @@
   }
   }
   
  -while (keepAliveCount  1) {
  +while (keepAliveCount  1  addCount  1) {
   try {
   Thread.sleep(10);
   } catch (InterruptedException e) {
  @@ -789,6 +790,22 @@
   }
   
   try {
  +// Add sockets which are waiting to the poller
  +if (addCount  0) {
  +synchronized (addS) {
  +for (int i = 0; i  addCount; i++) {
  +int rv = Poll.add
  +(serverPollset, addS[i], addP[i], 
Poll.APR_POLLIN);
  +if (rv == Status.APR_SUCCESS) {
  +keepAliveCount++;
  +} else {
  +// Can't do anything: close the socket 
right away
  +Pool.destroy(pool);
  +}
  +}
  +addCount = 0;
  +}
  +}
   // Pool for the specified interval
   int rv = Poll.poll(serverPollset, pollTime, desc, true);
   if (rv  0) {
  @@ -971,7 +988,8 @@
   // Range information
   public long start;
   public long end;
  -// Socket pool
  +// Socket and socket pool
  +public long socket;
   public long pool;
   // Position
   public long pos;
  @@ -990,6 +1008,9 @@
   protected long pool = 0;
   protected long[] desc;
   protected HashMap sendfileData;
  +
  +protected ArrayList addS;
  +
   protected void init() {
   pool = Pool.create(serverSockPool);
   try {
  @@ -1010,6 +1031,7 @@
   }
   desc = new long[sendfileSize * 4];
   sendfileData = new HashMap(sendfileSize);
  +addS = new ArrayList();
   }
   
   protected void 

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-04-23 Thread remm
remm2005/04/23 10:33:40

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Fix keepalive for sendfile.
  
  Revision  ChangesPath
  1.17  +9 -7  
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AprEndpoint.java  23 Apr 2005 17:05:31 -  1.16
  +++ AprEndpoint.java  23 Apr 2005 17:33:40 -  1.17
  @@ -1052,7 +1052,7 @@
   Pool.destroy(pool);
   }
   
  -public void add(long socket, SendfileData data) {
  +public boolean add(long socket, SendfileData data) {
   // Initialize fd from data given
   try {
   data.fdpool = Pool.create(data.pool);
  @@ -1069,26 +1069,27 @@
   if (nw  0) {
   if (!Status.APR_STATUS_IS_EAGAIN(-nw)) {
   Poll.destroy(data.pool);
  -return;
  +return false;
   }
   else {
   // Break the loop and add the socket to poller.
   break;
   }
  -}
  -else {
  +} else {
   data.pos = data.pos + nw;
   if (data.pos = data.end) {
   // Entire file has been send
  -Poll.destroy(data.pool);
  -return;
  +Poll.destroy(data.fdpool);
  +// Set back socket to blocking mode
  +Socket.optSet(socket, Socket.APR_SO_NONBLOCK, 0);
  +return true;
   }
   }
   }
   } catch (Error e) {
   // FIXME: more appropriate logging
   e.printStackTrace();
  -return;
  +return false;
   }
   synchronized (this) {
   // Add socket to the poller
  @@ -1103,6 +1104,7 @@
   Pool.destroy(data.pool);
   }
   }
  +return false;
   }
   
   public void remove(long socket) {
  
  
  
  1.9   +3 -2  
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Http11AprProcessor.java   20 Apr 2005 16:13:23 -  1.8
  +++ Http11AprProcessor.java   23 Apr 2005 17:33:40 -  1.9
  @@ -872,9 +872,10 @@
   
   // Do sendfile as needed: add socket to sendfile and end
   if (sendfileData != null) {
  -keepAlive = false;
   sendfileData.pool = pool;
  -endpoint.getSendfile().add(socket, sendfileData);
  +if (!endpoint.getSendfile().add(socket, sendfileData)) {
  +keepAlive = false;
  +}
   }
   
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-04-16 Thread remm
remm2005/04/16 10:49:19

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Implement the few missing methods for getRemoteAddr, etc.
  
  Revision  ChangesPath
  1.5   +64 -37
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Http11AprProcessor.java   15 Apr 2005 16:06:30 -  1.4
  +++ Http11AprProcessor.java   16 Apr 2005 17:49:19 -  1.5
  @@ -40,6 +40,7 @@
   import org.apache.coyote.http11.filters.VoidOutputFilter;
   import org.apache.coyote.http11.filters.BufferedInputFilter;
   import org.apache.tomcat.jni.Address;
  +import org.apache.tomcat.jni.Sockaddr;
   import org.apache.tomcat.jni.Socket;
   import org.apache.tomcat.util.buf.Ascii;
   import org.apache.tomcat.util.buf.ByteChunk;
  @@ -735,7 +736,8 @@
   remotePort = -1;
   localPort = -1;
   
  -// Setting up the I/O
  +// Setting up the socket
  +this.socket = socket;
   inputBuffer.setSocket(socket);
   outputBuffer.setSocket(socket);
   
  @@ -993,72 +995,97 @@
   
   } else if (actionCode == ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE) {
   
  -// FIXME: Implement getting host address
  -/*
  -if ((remoteAddr == null)  (socket != null)) {
  -InetAddress inetAddr = socket.getInetAddress();
  -if (inetAddr != null) {
  -remoteAddr = inetAddr.getHostAddress();
  +// Get remote host address
  +if (remoteAddr == null) {
  +try {
  +long sa = Address.get(Socket.APR_REMOTE, socket);
  +remoteAddr = Address.getip(sa);
  +} catch (Exception e) {
  +// Ignore
  +e.printStackTrace();
   }
   }
   request.remoteAddr().setString(remoteAddr);
  -*/
   
   } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE) 
{
   
  -// FIXME: Implement getting local address
  -/*
  -if ((localName == null)  (socket != null)) {
  -InetAddress inetAddr = socket.getLocalAddress();
  -if (inetAddr != null) {
  -localName = inetAddr.getHostName();
  +// Get local host name
  +if (localName == null) {
  +try {
  +long sa = Address.get(Socket.APR_LOCAL, socket);
  +localName = Address.getnameinfo(sa, 0);
  +} catch (Exception e) {
  +// Ignore
  +e.printStackTrace();
   }
   }
   request.localName().setString(localName);
  -*/
   
   } else if (actionCode == ActionCode.ACTION_REQ_HOST_ATTRIBUTE) {
   
  -// FIXME: Implement
  -/*
  -if ((remoteHost == null)  (socket != null)) {
  -InetAddress inetAddr = socket.getInetAddress();
  -if (inetAddr != null) {
  -remoteHost = inetAddr.getHostName();
  +// Get remote host name
  +if (remoteHost == null) {
  +try {
  +long sa = Address.get(Socket.APR_REMOTE, socket);
  +remoteHost = Address.getnameinfo(sa, 0);
  +} catch (Exception e) {
  +// Ignore
  +e.printStackTrace();
   }
   }
   request.remoteHost().setString(remoteHost);
  -*/
   
   } else if (actionCode == ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE) 
{
   
  -// FIXME: Implement
  -/*
  -if (localAddr == null)
  -   localAddr = socket.getLocalAddress().getHostAddress();
  +// Get local host address
  +if (localAddr == null) {
  +try {
  +long sa = Address.get(Socket.APR_LOCAL, socket);
  +Sockaddr addr = new Sockaddr();
  +if (Address.fill(addr, sa)) {
  +localAddr = addr.hostname;
  +localPort = addr.port;
  +}
  +} catch (Exception e) {
  +// Ignore
  +e.printStackTrace();
  +}
  +}
   
   request.localAddr().setString(localAddr);
  -*/
   
   } else if (actionCode == 

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-04-16 Thread remm
remm2005/04/16 10:51:48

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Proper logging.
  
  Revision  ChangesPath
  1.6   +7 -13 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Http11AprProcessor.java   16 Apr 2005 17:49:19 -  1.5
  +++ Http11AprProcessor.java   16 Apr 2005 17:51:48 -  1.6
  @@ -1001,8 +1001,7 @@
   long sa = Address.get(Socket.APR_REMOTE, socket);
   remoteAddr = Address.getip(sa);
   } catch (Exception e) {
  -// Ignore
  -e.printStackTrace();
  +log.warn(Exception getting socket information  ,e);
   }
   }
   request.remoteAddr().setString(remoteAddr);
  @@ -1015,8 +1014,7 @@
   long sa = Address.get(Socket.APR_LOCAL, socket);
   localName = Address.getnameinfo(sa, 0);
   } catch (Exception e) {
  -// Ignore
  -e.printStackTrace();
  +log.warn(Exception getting socket information  ,e);
   }
   }
   request.localName().setString(localName);
  @@ -1029,8 +1027,7 @@
   long sa = Address.get(Socket.APR_REMOTE, socket);
   remoteHost = Address.getnameinfo(sa, 0);
   } catch (Exception e) {
  -// Ignore
  -e.printStackTrace();
  +log.warn(Exception getting socket information  ,e);
   }
   }
   request.remoteHost().setString(remoteHost);
  @@ -1047,8 +1044,7 @@
   localPort = addr.port;
   }
   } catch (Exception e) {
  -// Ignore
  -e.printStackTrace();
  +log.warn(Exception getting socket information  ,e);
   }
   }
   
  @@ -1063,8 +1059,7 @@
   Sockaddr addr = Address.getInfo(sa);
   remotePort = addr.port;
   } catch (Exception e) {
  -// Ignore
  -e.printStackTrace();
  +log.warn(Exception getting socket information  ,e);
   }
   }
   request.setRemotePort(remotePort);
  @@ -1081,8 +1076,7 @@
   localPort = addr.port;
   }
   } catch (Exception e) {
  -// Ignore
  -e.printStackTrace();
  +log.warn(Exception getting socket information  ,e);
   }
   }
   request.setLocalPort(localPort);
  @@ -1105,7 +1099,7 @@
   (SSLSupport.CERTIFICATE_KEY, sslO);
   }
   } catch (Exception e) {
  -log.warn(Exception getting SSL Cert,e);
  +log.warn(Exception getting SSL Cert, e);
   }
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java InternalAprInputBuffer.java

2005-04-15 Thread remm
remm2005/04/15 06:46:11

  Modified:http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java InternalAprInputBuffer.java
  Log:
  - Fix my hack thanks to a trick from Mladen. Now performance is actually 
decent.
  
  Revision  ChangesPath
  1.2   +0 -24 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Http11AprProcessor.java   14 Apr 2005 18:52:28 -  1.1
  +++ Http11AprProcessor.java   15 Apr 2005 13:46:11 -  1.2
  @@ -745,30 +745,6 @@
   int keepAliveLeft = maxKeepAliveRequests;
   long soTimeout = endpoint.getSoTimeout();
   
  -// FIXME: Should not be needed 
  -/*
  -long oldSoTimeout = soTimeout;
  -int threadRatio = (endpoint.getCurrentThreadsBusy() * 100)
  -/ endpoint.getMaxThreads();
  -if ((threadRatio  33)  (threadRatio = 66)) {
  -soTimeout = soTimeout / 2;
  -} else if ((threadRatio  66)  (threadRatio = 90)) {
  -soTimeout = soTimeout / 3;
  -keepAliveLeft = 1;
  -} else if (threadRatio  90) {
  -soTimeout = soTimeout / 20;
  -keepAliveLeft = 1;
  -}
  -
  -if (soTimeout != oldSoTimeout) {
  -try {
  -Socket.timeoutSet(socket, soTimeout);
  -} catch (Throwable t) {
  -log.debug(Error setting timeout, t);
  -error = true;
  -}
  -}*/
  -
   boolean keptAlive = false;
   boolean openSocket = false;
   
  
  
  
  1.3   +8 -28 
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java
  
  Index: InternalAprInputBuffer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalAprInputBuffer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InternalAprInputBuffer.java   14 Apr 2005 20:09:16 -  1.2
  +++ InternalAprInputBuffer.java   15 Apr 2005 13:46:11 -  1.3
  @@ -387,26 +387,16 @@
   // Skipping blank lines
   //
   
  -if (keptAlive  pos = lastValid) {
  -Socket.timeoutSet(socket, 0);
  -}
  -
   byte chr = 0;
   do {
   
   // Read new bytes if needed
   if (pos = lastValid) {
   if (keptAlive) {
  -// Set socket in non blocking mode and try to read
  -int attempts = 0;
  -try {
  -while (attempts  3  !fill()) {
  -Thread.sleep(2);
  -attempts++;
  -}
  -} catch (InterruptedException e) {
  -// FIXME: do something
  -e.printStackTrace();
  +// Do a simple read with a short timeout
  +int nRead = Socket.recvt(socket, buf, pos, buf.length - 
lastValid, 5);
  +if (nRead  0) {
  +lastValid = pos + nRead;
   }
   if (pos = lastValid) {
   return false;
  @@ -427,26 +417,16 @@
   start = pos;
   
   if (keptAlive  pos = lastValid) {
  -// Set socket in non blocking mode and try to read
  -int attempts = 0;
  -try {
  -while (attempts  3  !fill()) {
  -Thread.sleep(2);
  -attempts++;
  -}
  -} catch (InterruptedException e) {
  -// FIXME: do something
  -e.printStackTrace();
  +// Do a simple read with a short timeout
  +int nRead = Socket.recvt(socket, buf, pos, buf.length - 
lastValid, 5);
  +if (nRead  0) {
  +lastValid = pos + nRead;
   }
   if (pos = lastValid) {
   return false;
   }
   }
   
  -if (keptAlive) {
  -Socket.timeoutSet(socket, timeout);
  -}
  -
   //
   // Reading the method name
   // Method name is always US-ASCII
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java InternalAprInputBuffer.java

2005-04-15 Thread remm
remm2005/04/15 08:49:33

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java InternalAprInputBuffer.java
  Log:
  - Add configuration flags.
  - Better sync for the poller.
  - There's a problem with the poller in this commit under investigation, 
though.
  
  Revision  ChangesPath
  1.4   +72 -46
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AprEndpoint.java  15 Apr 2005 09:23:37 -  1.3
  +++ AprEndpoint.java  15 Apr 2005 15:49:32 -  1.4
  @@ -23,6 +23,7 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.tomcat.jni.Address;
  +import org.apache.tomcat.jni.Error;
   import org.apache.tomcat.jni.Library;
   import org.apache.tomcat.jni.Poll;
   import org.apache.tomcat.jni.Pool;
  @@ -242,6 +243,23 @@
   public void setSoTimeout(int soTimeout) { this.soTimeout = soTimeout; }
   
   
  +/**
  + * Timeout on first request read before going to the poller, in ms.
  + */
  +protected int firstReadPollerTimeout = 100;
  +public int getFirstReadPollerTimeout() { return firstReadPollerTimeout; }
  +public void setFirstReadPollerTimeout(int firstReadPollerTimeout) { 
this.firstReadPollerTimeout = firstReadPollerTimeout; }
  +
  +
  +/**
  + * Poll interval, in microseconds. The smaller the value, the more CPU 
the poller
  + * will use, but the more responsive to activity it will be.
  + */
  +protected int pollTime = 10;
  +public int getPollTime() { return pollTime; }
  +public void setPollTime(int pollTime) { this.pollTime = pollTime; }
  +
  +
   /** 
* The default is true - the created threads will be
*  in daemon mode. If set to false, the control thread
  @@ -356,7 +374,7 @@
   // Create the APR address that will be bound
   String addressStr = null;
   if (address == null) {
  -addressStr = 0.0.0.0;
  +addressStr = null;
   } else {
   addressStr =  + address;
   }
  @@ -677,16 +695,18 @@
   protected long serverPollset = 0;
   protected long pool = 0;
   protected long[] desc;
  +protected long[] sockets;
   
   public Poller(int size) {
  +pool = Pool.create(serverSockPool);
   try {
  -pool = Pool.create(serverSockPool);
   serverPollset = Poll.create(size, pool, 0, soTimeout * 1000);
  -desc = new long[size];
  -} catch( Exception ex ) {
  +} catch (Error e) {
   // FIXME: more appropriate logging
  -ex.printStackTrace();
  +e.printStackTrace();
   }
  +desc = new long[size];
  +sockets = new long[size];
   }
   
   public synchronized void add(long socket, long pool) {
  @@ -696,7 +716,7 @@
   }
   }
   
  -public synchronized void remove(long socket) {
  +public void remove(long socket) {
   int rv = Poll.remove(serverPollset, socket);
   if (rv == Status.APR_SUCCESS) {
   keepAliveCount--;
  @@ -730,50 +750,56 @@
   }
   
   try {
  -// Pool for one second
  -// FIXME: Polling time could be configurable
  -int rv = Poll.poll(serverPollset, 10, desc);
  -for (int n = 0; n  rv; n++) {
  -long socket = Poll.socket(desc[n]);
  -int pool = (int) Poll.data(desc[n]);
  -remove(socket);
  -
  -int events = Poll.events(desc[n]);
  -
  -if (((events  Poll.APR_POLLHUP) == Poll.APR_POLLHUP)
  -|| ((events  Poll.APR_POLLERR) == 
Poll.APR_POLLERR)) {
  -// Close socket and clear pool
  -Pool.destroy(pool);
  -continue;
  -}
  -
  -if (!((events  Poll.APR_POLLIN) == 
Poll.APR_POLLIN)) {
  -// Close socket and clear pool
  -Pool.destroy(pool);
  -continue;
  +// Pool for the specified interval
  +int rv = 

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java

2005-04-15 Thread remm
remm2005/04/15 09:06:30

  Modified:util/java/org/apache/tomcat/util/net AprEndpoint.java
   http11/src/java/org/apache/coyote/http11
Http11AprProcessor.java
  Log:
  - Some changes suggested by Mladen (but the poller still has an issue for me).
  - Shorter property name.
  
  Revision  ChangesPath
  1.5   +19 -15
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AprEndpoint.java  15 Apr 2005 15:49:32 -  1.4
  +++ AprEndpoint.java  15 Apr 2005 16:06:30 -  1.5
  @@ -246,9 +246,9 @@
   /**
* Timeout on first request read before going to the poller, in ms.
*/
  -protected int firstReadPollerTimeout = 100;
  -public int getFirstReadPollerTimeout() { return firstReadPollerTimeout; }
  -public void setFirstReadPollerTimeout(int firstReadPollerTimeout) { 
this.firstReadPollerTimeout = firstReadPollerTimeout; }
  +protected int firstReadTimeout = 100;
  +public int getFirstReadTimeout() { return firstReadTimeout; }
  +public void setFirstReadTimeout(int firstReadTimeout) { 
this.firstReadTimeout = firstReadTimeout; }
   
   
   /**
  @@ -696,6 +696,8 @@
   protected long pool = 0;
   protected long[] desc;
   protected long[] sockets;
  +protected long[] events;
  +protected long[] pools;
   
   public Poller(int size) {
   pool = Pool.create(serverSockPool);
  @@ -707,6 +709,8 @@
   }
   desc = new long[size];
   sockets = new long[size];
  +events = new long[size];
  +pools = new long[size];
   }
   
   public synchronized void add(long socket, long pool) {
  @@ -755,28 +759,28 @@
   if (rv  0) {
   synchronized (this) {
   for (int n = 0; n  rv; n++) {
  -// Remove each socket from the poll right 
away
   sockets[n] = Poll.socket(desc[n]);
  +// Get the socket pool
  +pools[n] = Poll.data(desc[n]);
  +// Get retuned events for this socket
  +events[n] = Poll.events(desc[n]);
  +// Remove each socket from the poll right 
away
   remove(sockets[n]);
   }
   }
   for (int n = 0; n  rv; n++) {
  -// Get the socket pool
  -int pool = (int) Poll.data(desc[n]);
  -// Get retuned events for this socket
  -int events = Poll.events(desc[n]);
  -//System.out.println(Events:  + sockets[n] +  
code:  + events +  OK:  + Poll.APR_POLLIN);
  +//System.out.println(Events:  + sockets[n] +  
code:  + events[n] +  OK:  + Poll.APR_POLLIN);
   // Problem events
  -if (((events  Poll.APR_POLLHUP) == 
Poll.APR_POLLHUP)
  -|| ((events  Poll.APR_POLLERR) == 
Poll.APR_POLLERR)) {
  +if (((events[n]  Poll.APR_POLLHUP) == 
Poll.APR_POLLHUP)
  +|| ((events[n]  Poll.APR_POLLERR) == 
Poll.APR_POLLERR)) {
   // Close socket and clear pool
  -Pool.destroy(pool);
  +Pool.destroy(pools[n]);
   continue;
   }
   // Anything non normal
  -if (!((events  Poll.APR_POLLIN) == 
Poll.APR_POLLIN)) {
  +if (!((events[n]  Poll.APR_POLLIN) == 
Poll.APR_POLLIN)) {
   // Close socket and clear pool
  -Pool.destroy(pool);
  +Pool.destroy(pools[n]);
   continue;
   }
   // Allocate a new worker thread
  @@ -796,7 +800,7 @@
   }
   // Hand this socket off to an appropriate 
processor
   //System.out.println(Process:  + sockets[n]);
  -workerThread.assign(sockets[n], pool);
  +workerThread.assign(sockets[n], pools[n]);