On 12/07/2012 21:11, [email protected] wrote:
> Author: fhanik
> Date: Thu Jul 12 20:11:31 2012
> New Revision: 1360905
> 
> URL: http://svn.apache.org/viewvc?rev=1360905&view=rev
> Log:
> Correct handling of timeout - negative or zero means no timeout but an instant

Nope. The expected and documented behaviour for a negative timeout for
all connectors is an infinite timeout.

Mark

> 
> 
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> 
> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java?rev=1360905&r1=1360904&r2=1360905&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java 
> (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java Thu Jul 
> 12 20:11:31 2012
> @@ -196,7 +196,11 @@ public class NioSelectorPool {
>                      //register OP_WRITE to the selector
>                      if (key==null) key = 
> socket.getIOChannel().register(selector, SelectionKey.OP_WRITE);
>                      else key.interestOps(SelectionKey.OP_WRITE);
> -                    keycount = selector.select(writeTimeout);
> +                    if (writeTimeout<=0) {
> +                        keycount = selector.selectNow();
> +                    } else {
> +                        keycount = selector.select(writeTimeout);
> +                    }
>                  }
>                  if (writeTimeout > 0 && (selector == null || keycount == 0) 
> ) timedout = (System.currentTimeMillis()-time)>=writeTimeout;
>              }//while
> @@ -264,7 +268,11 @@ public class NioSelectorPool {
>                      //register OP_WRITE to the selector
>                      if (key==null) key = 
> socket.getIOChannel().register(selector, SelectionKey.OP_READ);
>                      else key.interestOps(SelectionKey.OP_READ);
> -                    keycount = selector.select(readTimeout);
> +                    if (readTimeout<=0) {
> +                        keycount = selector.selectNow();
> +                    } else {
> +                        keycount = selector.select(readTimeout);
> +                    }
>                  }
>                  if (readTimeout > 0 && (selector == null || keycount == 0) ) 
> timedout = (System.currentTimeMillis()-time)>=readTimeout;
>              }//while
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to