You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2018/06/02 19:40:31 UTC
svn commit: r1832744 -
/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
Author: remm
Date: Sat Jun 2 19:40:31 2018
New Revision: 1832744
URL: http://svn.apache.org/viewvc?rev=1832744&view=rev
Log:
Add more missing timeouts, submitted by Alex Marchevskiy.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java?rev=1832744&r1=1832743&r2=1832744&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java Sat Jun 2 19:40:31 2018
@@ -371,7 +371,8 @@ public class SecureNio2Channel extends N
// an optimisation for the typical case so we don't create an
// SNIExtractor only to discover there is no data to process
if (netInBuffer.position() == 0) {
- sc.read(netInBuffer, socket, handshakeReadCompletionHandler);
+ sc.read(netInBuffer, Nio2Endpoint.toNio2Timeout(endpoint.getConnectionTimeout()),
+ TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
return 1;
}
@@ -386,7 +387,8 @@ public class SecureNio2Channel extends N
Integer.toString(newLimit)));
netInBuffer = ByteBufferUtils.expand(netInBuffer, newLimit);
- sc.read(netInBuffer, socket, handshakeReadCompletionHandler);
+ sc.read(netInBuffer, Nio2Endpoint.toNio2Timeout(endpoint.getConnectionTimeout()),
+ TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
return 1;
}
@@ -403,7 +405,8 @@ public class SecureNio2Channel extends N
clientRequestedCiphers = extractor.getClientRequestedCiphers();
break;
case NEED_READ:
- sc.read(netInBuffer, socket, handshakeReadCompletionHandler);
+ sc.read(netInBuffer, Nio2Endpoint.toNio2Timeout(endpoint.getConnectionTimeout()),
+ TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
return 1;
case UNDERFLOW:
// Unable to buffer enough data to read SNI extension data
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1832744 - /tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
Posted by Rémy Maucherat <re...@apache.org>.
On Sat, Jun 2, 2018 at 10:38 PM Christopher Schultz <
chris@christopherschultz.net> wrote:
> Rémy,
>
> On 6/2/18 3:40 PM, remm@apache.org wrote:
> > Author: remm
> > Date: Sat Jun 2 19:40:31 2018
> > New Revision: 1832744
> >
> > URL: http://svn.apache.org/viewvc?rev=1832744&view=rev
> > Log:
> > Add more missing timeouts, submitted by Alex Marchevskiy.
> >
> > Modified:
> > tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
> >
> > Modified:
> tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
> > URL:
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java?rev=1832744&r1=1832743&r2=1832744&view=diff
> >
> ==============================================================================
> > --- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
> (original)
> > +++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
> Sat Jun 2 19:40:31 2018
> > @@ -371,7 +371,8 @@ public class SecureNio2Channel extends N
> > // an optimisation for the typical case so we don't create an
> > // SNIExtractor only to discover there is no data to process
> > if (netInBuffer.position() == 0) {
> > - sc.read(netInBuffer, socket,
> handshakeReadCompletionHandler);
> > + sc.read(netInBuffer,
> Nio2Endpoint.toNio2Timeout(endpoint.getConnectionTimeout()),
> > + TimeUnit.MILLISECONDS, socket,
> handshakeReadCompletionHandler);
>
> Is "Nio2Endpoint.toNio2Timeout(endpoint.getConnectionTimeout())", etc.
> something worth computing once and storing? I know its a simple
> comparison, but it could improve CPU usage/performance a small amount.
>
Hum, no because only one of the reads will be called during each processSNI
invocation (it then returns 1 after it). And it's extremely inexpensive too.
Rémy
Re: svn commit: r1832744 -
/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Rémy,
On 6/2/18 3:40 PM, remm@apache.org wrote:
> Author: remm
> Date: Sat Jun 2 19:40:31 2018
> New Revision: 1832744
>
> URL: http://svn.apache.org/viewvc?rev=1832744&view=rev
> Log:
> Add more missing timeouts, submitted by Alex Marchevskiy.
>
> Modified:
> tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
>
> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java?rev=1832744&r1=1832743&r2=1832744&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/net/SecureNio2Channel.java Sat Jun 2 19:40:31 2018
> @@ -371,7 +371,8 @@ public class SecureNio2Channel extends N
> // an optimisation for the typical case so we don't create an
> // SNIExtractor only to discover there is no data to process
> if (netInBuffer.position() == 0) {
> - sc.read(netInBuffer, socket, handshakeReadCompletionHandler);
> + sc.read(netInBuffer, Nio2Endpoint.toNio2Timeout(endpoint.getConnectionTimeout()),
> + TimeUnit.MILLISECONDS, socket, handshakeReadCompletionHandler);
Is "Nio2Endpoint.toNio2Timeout(endpoint.getConnectionTimeout())", etc.
something worth computing once and storing? I know its a simple
comparison, but it could improve CPU usage/performance a small amount.
-chris