On 28/02/2012 18:53, Filip Hanik - Dev Lists wrote: > On 2/28/2012 11:39 AM, Mark Thomas wrote:
>> You may also be able to help with some problems I am having getting >> non-blocking behaviour between messages with NIO. I'm not 100% clear >> what is happening yet, but I think it is something like: >> - HTTP GET (with upgrade request arrives >> - Upgrade is processed >> - no ws frame on the wire (yet) so process of handing back to the >> selector starts >> - first ws frame arrives >> - socket is handed back to the selector >> - selector *does not* trigger indicating there is data to process >> - some delay of a few seconds >> - client sends another ws frame >> - selector triggers >> - both frames are processed > > I can take a look at this, I've not seen this behavior before, it's been > very accurate. Very similar behaviour has been observed in the unit tests for Comet with the NIO connector ever since they were introduced. > Send it my way, I will take a look I have updated trunk to support non-blocking and it is working for APR. The patch to enable it for NIO is: --- a/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java +++ b/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java @@ -104,12 +104,10 @@ public class UpgradeNioProcessor extends UpgradeProcessor<NioChannel> { @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); } } I have been using the Autobahn WebSocket test suite and everything should pass if: - you point Autobahn at the following endpoint ws://localhost:8080/examples/websocket/echoMessage - you increase the max buffer size to > 16M (if not some tests fail) - don't run Autobahn on Windows - python performance is terrible for the tests that send lots of little packets Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org