From d52e61241d55425e0cfced608ebb28942874be8a Mon Sep 17 00:00:00 2001 From: fhanik Date: Thu, 26 Oct 2006 20:57:28 +0000 Subject: [PATCH] Ooops, forgot to pass in the double buffered channel to the selector pool for write and read operations git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@468132 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/coyote/http11/InternalNioInputBuffer.java | 2 +- java/org/apache/coyote/http11/InternalNioOutputBuffer.java | 2 +- java/org/apache/tomcat/util/net/NioSelectorPool.java | 8 ++++---- java/org/apache/tomcat/util/net/SecureNioChannel.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/java/org/apache/coyote/http11/InternalNioInputBuffer.java b/java/org/apache/coyote/http11/InternalNioInputBuffer.java index 5504152cd..3acd07f92 100644 --- a/java/org/apache/coyote/http11/InternalNioInputBuffer.java +++ b/java/org/apache/coyote/http11/InternalNioInputBuffer.java @@ -570,7 +570,7 @@ public class InternalNioInputBuffer implements InputBuffer { Selector selector = null; try { selector = getSelectorPool().get(); }catch ( IOException x ) {} try { - nRead = getSelectorPool().read(socket.getBufHandler().getReadBuffer(),socket.getIOChannel(),selector,rto); + nRead = getSelectorPool().read(socket.getBufHandler().getReadBuffer(),socket,selector,rto); } catch ( EOFException eof ) { nRead = -1; } finally { diff --git a/java/org/apache/coyote/http11/InternalNioOutputBuffer.java b/java/org/apache/coyote/http11/InternalNioOutputBuffer.java index 206880fcd..1525dd89c 100644 --- a/java/org/apache/coyote/http11/InternalNioOutputBuffer.java +++ b/java/org/apache/coyote/http11/InternalNioOutputBuffer.java @@ -431,7 +431,7 @@ public class InternalNioOutputBuffer //ignore } try { - written = getSelectorPool().write(bytebuffer, socket.getIOChannel(), selector, writeTimeout); + written = getSelectorPool().write(bytebuffer, socket, selector, writeTimeout); //make sure we are flushed do { if (socket.flush(selector)) break; diff --git a/java/org/apache/tomcat/util/net/NioSelectorPool.java b/java/org/apache/tomcat/util/net/NioSelectorPool.java index d6d03257d..61b4a8bb4 100644 --- a/java/org/apache/tomcat/util/net/NioSelectorPool.java +++ b/java/org/apache/tomcat/util/net/NioSelectorPool.java @@ -99,7 +99,7 @@ public class NioSelectorPool { * @throws SocketTimeoutException if the write times out * @throws IOException if an IO Exception occurs in the underlying socket logic */ - public int write(ByteBuffer buf, SocketChannel socket, Selector selector, long writeTimeout) throws IOException { + public int write(ByteBuffer buf, NioChannel socket, Selector selector, long writeTimeout) throws IOException { SelectionKey key = null; int written = 0; boolean timedout = false; @@ -118,7 +118,7 @@ public class NioSelectorPool { } if ( selector != null ) { //register OP_WRITE to the selector - if (key==null) key = socket.register(selector, SelectionKey.OP_WRITE); + if (key==null) key = socket.getIOChannel().register(selector, SelectionKey.OP_WRITE); else key.interestOps(SelectionKey.OP_WRITE); keycount = selector.select(writeTimeout); } @@ -147,7 +147,7 @@ public class NioSelectorPool { * @throws SocketTimeoutException if the read times out * @throws IOException if an IO Exception occurs in the underlying socket logic */ - public int read(ByteBuffer buf, SocketChannel socket, Selector selector, long readTimeout) throws IOException { + public int read(ByteBuffer buf, NioChannel socket, Selector selector, long readTimeout) throws IOException { SelectionKey key = null; int read = 0; boolean timedout = false; @@ -163,7 +163,7 @@ public class NioSelectorPool { } if ( selector != null ) { //register OP_WRITE to the selector - if (key==null) key = socket.register(selector, SelectionKey.OP_READ); + if (key==null) key = socket.getIOChannel().register(selector, SelectionKey.OP_READ); else key.interestOps(SelectionKey.OP_READ); keycount = selector.select(readTimeout); } diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java b/java/org/apache/tomcat/util/net/SecureNioChannel.java index 44da15e5d..d2b0efc1b 100644 --- a/java/org/apache/tomcat/util/net/SecureNioChannel.java +++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java @@ -87,7 +87,7 @@ public class SecureNioChannel extends NioChannel { * @return boolean */ public boolean flush(Selector s, long timeout) throws IOException { - pool.write(netOutBuffer,sc,s,timeout); + pool.write(netOutBuffer,this,s,timeout); return !netOutBuffer.hasRemaining(); } -- 2.11.0