Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/channel/REPSelectionKey.java @ 208:302c4a0afab6
*** empty log message ***
author | kono |
---|---|
date | Sat, 30 Aug 2008 12:15:21 +0900 |
parents | 4c0a94836357 |
children | ed43dc6ccb07 |
line wrap: on
line diff
--- a/rep/channel/REPSelectionKey.java Sat Aug 30 11:51:42 2008 +0900 +++ b/rep/channel/REPSelectionKey.java Sat Aug 30 12:15:21 2008 +0900 @@ -30,8 +30,14 @@ public SelectableChannel channel(REPPack<P>packer) { if (REPServerSocketChannel.isSimulation) return key.channel(); if (key.isAcceptable()) { + SelectableChannel sc = key.channel(); + SelectableChannel rsc = REPSocketChannel.channels.get(sc); + if (rsc!=null) return rsc; return new REPServerSocketChannel<P>(key.channel(),packer); } else if (key.isReadable()) { + SelectableChannel sc = key.channel(); + SelectableChannel rsc = REPSocketChannel.channels.get(sc); + if (rsc!=null) return rsc; return new REPSocketChannel<P>(key.channel(),packer); } return null; @@ -63,6 +69,7 @@ return key.selector(); // should return REPSelector } + @SuppressWarnings("unchecked") public REPSocketChannel<P> accept(REPPack<P> pack) throws IOException { assert(!REPServerSocketChannel.isSimulation); if (!key.isAcceptable()) throw new IOException(); @@ -70,6 +77,8 @@ if (ssc==null) return null; SocketChannel ss = (SocketChannel)ssc.accept(); if (ss==null) return null; + REPSocketChannel<P> rsc = (REPSocketChannel<P>)REPSocketChannel.channels.get(ss); + if (rsc!=null) return rsc; return new REPSocketChannel<P>(ss,pack); }