You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2012/03/02 00:05:51 UTC

svn commit: r1295978 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11NioProtocol.java upgrade/UpgradeNioProcessor.java

Author: fhanik
Date: Thu Mar  1 23:05:51 2012
New Revision: 1295978

URL: http://svn.apache.org/viewvc?rev=1295978&view=rev
Log:
Fix WebSocket's non blocking call
http://tomcat.markmail.org/thread/drj7zgq2csfdnvoh#query:+page:1+mid:y4dheqpm2wx5xzba+state:results


Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1295978&r1=1295977&r2=1295978&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Thu Mar  1 23:05:51 2012
@@ -296,12 +296,7 @@ public class Http11NioProtocol extends A
         protected void upgradePoll(SocketWrapper<NioChannel> socket,
                 Processor<NioChannel> processor) {
             connections.put(socket.getSocket(), processor);
-
-            SelectionKey key = socket.getSocket().getIOChannel().keyFor(
-                    socket.getSocket().getPoller().getSelector());
-            key.interestOps(SelectionKey.OP_READ);
-            ((KeyAttachment) socket).interestOps(
-                    SelectionKey.OP_READ);
+            socket.getSocket().getPoller().add(socket.getSocket());
         }
     }
 }

Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1295978&r1=1295977&r2=1295978&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Thu Mar  1 23:05:51 2012
@@ -104,12 +104,10 @@ public class UpgradeNioProcessor extends
     @Override
     public int read(boolean block, byte[] bytes, int off, int len)
             throws IOException {
-        // TODO Implement non-blocking reads. Should be as simple as replacing
-        // true with block in the two lines below
         if (len > maxRead) {
-            return readSocket(true, bytes, off, maxRead);
+            return readSocket(block, bytes, off, maxRead);
         } else {
-            return readSocket(true, bytes, off, len);
+            return readSocket(block, bytes, off, len);
         }
     }
 



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


Re: svn commit: r1295978 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11NioProtocol.java upgrade/UpgradeNioProcessor.java

Posted by Mark Thomas <ma...@apache.org>.
On 01/03/2012 23:47, Filip Hanik - Dev Lists wrote:
> Thanks for that John, I'll fix that too.

That probably explains the Comet failures we have been seeing in the
unit tests. Excellent.

Mark

> 
> Filip
> 
> On 3/1/2012 4:42 PM, Johno Crawford wrote:
>> On 2/03/2012 12:05 AM, fhanik@apache.org wrote:
>>> Author: fhanik
>>> Date: Thu Mar  1 23:05:51 2012
>>> New Revision: 1295978
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1295978&view=rev
>>> Log:
>>> Fix WebSocket's non blocking call
>>> http://tomcat.markmail.org/thread/drj7zgq2csfdnvoh#query:+page:1+mid:y4dheqpm2wx5xzba+state:results
>>>
>>
>> Looks like the same usage in
>> org.apache.coyote.http11.Http11NioProtocol.Http11ConnectionHandler#longPoll
>> ?
>>>
>>>
>>> Modified:
>>>      tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>>>     
>>> tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
>>>
>>>
>>> Modified:
>>> tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>>> URL:
>>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1295978&r1=1295977&r2=1295978&view=diff
>>>
>>> ==============================================================================
>>>
>>> --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>>> (original)
>>> +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>>> Thu Mar  1 23:05:51 2012
>>> @@ -296,12 +296,7 @@ public class Http11NioProtocol extends A
>>>           protected void upgradePoll(SocketWrapper<NioChannel>  socket,
>>>                   Processor<NioChannel>  processor) {
>>>               connections.put(socket.getSocket(), processor);
>>> -
>>> -            SelectionKey key =
>>> socket.getSocket().getIOChannel().keyFor(
>>> -                    socket.getSocket().getPoller().getSelector());
>>> -            key.interestOps(SelectionKey.OP_READ);
>>> -            ((KeyAttachment) socket).interestOps(
>>> -                    SelectionKey.OP_READ);
>>> +            socket.getSocket().getPoller().add(socket.getSocket());
>>>           }
>>>       }
>>>   }
>>>
>>> Modified:
>>> tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
>>>
>>> URL:
>>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1295978&r1=1295977&r2=1295978&view=diff
>>>
>>> ==============================================================================
>>>
>>> ---
>>> tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
>>> (original)
>>> +++
>>> tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
>>> Thu Mar  1 23:05:51 2012
>>> @@ -104,12 +104,10 @@ public class UpgradeNioProcessor extends
>>>       @Override
>>>       public int read(boolean block, byte[] bytes, int off, int len)
>>>               throws IOException {
>>> -        // TODO Implement non-blocking reads. Should be as simple as
>>> replacing
>>> -        // true with block in the two lines below
>>>           if (len>  maxRead) {
>>> -            return readSocket(true, bytes, off, maxRead);
>>> +            return readSocket(block, bytes, off, maxRead);
>>>           } else {
>>> -            return readSocket(true, bytes, off, len);
>>> +            return readSocket(block, bytes, off, len);
>>>           }
>>>       }
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


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


Re: svn commit: r1295978 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11NioProtocol.java upgrade/UpgradeNioProcessor.java

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Thanks for that John, I'll fix that too.

Filip

On 3/1/2012 4:42 PM, Johno Crawford wrote:
> On 2/03/2012 12:05 AM, fhanik@apache.org wrote:
>> Author: fhanik
>> Date: Thu Mar  1 23:05:51 2012
>> New Revision: 1295978
>>
>> URL: http://svn.apache.org/viewvc?rev=1295978&view=rev
>> Log:
>> Fix WebSocket's non blocking call
>> http://tomcat.markmail.org/thread/drj7zgq2csfdnvoh#query:+page:1+mid:y4dheqpm2wx5xzba+state:results
>
> Looks like the same usage in org.apache.coyote.http11.Http11NioProtocol.Http11ConnectionHandler#longPoll ?
>>
>>
>> Modified:
>>      tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>>      tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
>>
>> Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1295978&r1=1295977&r2=1295978&view=diff
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
>> +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Thu Mar  1 23:05:51 2012
>> @@ -296,12 +296,7 @@ public class Http11NioProtocol extends A
>>           protected void upgradePoll(SocketWrapper<NioChannel>  socket,
>>                   Processor<NioChannel>  processor) {
>>               connections.put(socket.getSocket(), processor);
>> -
>> -            SelectionKey key = socket.getSocket().getIOChannel().keyFor(
>> -                    socket.getSocket().getPoller().getSelector());
>> -            key.interestOps(SelectionKey.OP_READ);
>> -            ((KeyAttachment) socket).interestOps(
>> -                    SelectionKey.OP_READ);
>> +            socket.getSocket().getPoller().add(socket.getSocket());
>>           }
>>       }
>>   }
>>
>> Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1295978&r1=1295977&r2=1295978&view=diff
>> ==============================================================================
>> --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java (original)
>> +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Thu Mar  1 23:05:51 2012
>> @@ -104,12 +104,10 @@ public class UpgradeNioProcessor extends
>>       @Override
>>       public int read(boolean block, byte[] bytes, int off, int len)
>>               throws IOException {
>> -        // TODO Implement non-blocking reads. Should be as simple as replacing
>> -        // true with block in the two lines below
>>           if (len>  maxRead) {
>> -            return readSocket(true, bytes, off, maxRead);
>> +            return readSocket(block, bytes, off, maxRead);
>>           } else {
>> -            return readSocket(true, bytes, off, len);
>> +            return readSocket(block, bytes, off, len);
>>           }
>>       }
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>


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


Re: svn commit: r1295978 - in /tomcat/trunk/java/org/apache/coyote/http11: Http11NioProtocol.java upgrade/UpgradeNioProcessor.java

Posted by Johno Crawford <jo...@sulake.com>.
On 2/03/2012 12:05 AM, fhanik@apache.org wrote:
> Author: fhanik
> Date: Thu Mar  1 23:05:51 2012
> New Revision: 1295978
>
> URL: http://svn.apache.org/viewvc?rev=1295978&view=rev
> Log:
> Fix WebSocket's non blocking call
> http://tomcat.markmail.org/thread/drj7zgq2csfdnvoh#query:+page:1+mid:y4dheqpm2wx5xzba+state:results

Looks like the same usage in 
org.apache.coyote.http11.Http11NioProtocol.Http11ConnectionHandler#longPoll 
?
>
>
> Modified:
>      tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
>      tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
>
> Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1295978&r1=1295977&r2=1295978&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
> +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Thu Mar  1 23:05:51 2012
> @@ -296,12 +296,7 @@ public class Http11NioProtocol extends A
>           protected void upgradePoll(SocketWrapper<NioChannel>  socket,
>                   Processor<NioChannel>  processor) {
>               connections.put(socket.getSocket(), processor);
> -
> -            SelectionKey key = socket.getSocket().getIOChannel().keyFor(
> -                    socket.getSocket().getPoller().getSelector());
> -            key.interestOps(SelectionKey.OP_READ);
> -            ((KeyAttachment) socket).interestOps(
> -                    SelectionKey.OP_READ);
> +            socket.getSocket().getPoller().add(socket.getSocket());
>           }
>       }
>   }
>
> Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1295978&r1=1295977&r2=1295978&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java (original)
> +++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java Thu Mar  1 23:05:51 2012
> @@ -104,12 +104,10 @@ public class UpgradeNioProcessor extends
>       @Override
>       public int read(boolean block, byte[] bytes, int off, int len)
>               throws IOException {
> -        // TODO Implement non-blocking reads. Should be as simple as replacing
> -        // true with block in the two lines below
>           if (len>  maxRead) {
> -            return readSocket(true, bytes, off, maxRead);
> +            return readSocket(block, bytes, off, maxRead);
>           } else {
> -            return readSocket(true, bytes, off, len);
> +            return readSocket(block, bytes, off, len);
>           }
>       }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

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