changeset 190:63701e2a2fe8

*** empty log message ***
author kent
date Fri, 29 Aug 2008 18:51:37 +0900
parents d03e34861a26
children dbf59f82273e
files rep/channel/REPSelector.java rep/channel/REPServerSocketChannel.java rep/channel/SelectorSimulator.java
diffstat 3 files changed, 18 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/rep/channel/REPSelector.java	Fri Aug 29 17:16:51 2008 +0900
+++ b/rep/channel/REPSelector.java	Fri Aug 29 18:51:37 2008 +0900
@@ -78,6 +78,9 @@
 	public SelectionKey register(SelectableChannel ch, int ops, Object att) throws ClosedChannelException{
 		return ch.register(selector, ops, att);
 	}
+	public SelectionKey register(SelectableChannel ch, int ops) throws ClosedChannelException{
+		return register(ch, ops, null);
+	}
 	/*
 	public SelectionKey register(REPSocketChannel<?> ch, int ops, Object att) throws ClosedChannelException{
 		return ch.register(selector, ops, att);
--- a/rep/channel/REPServerSocketChannel.java	Fri Aug 29 17:16:51 2008 +0900
+++ b/rep/channel/REPServerSocketChannel.java	Fri Aug 29 18:51:37 2008 +0900
@@ -15,16 +15,16 @@
 public class REPServerSocketChannel<P> extends ServerSocketChannel{
 
 	public static boolean isSimulation;
-	//private ServerSocketChannel ss;
+	private ServerSocketChannel ss;
 	private REPPack<P> packer;
 	
-	/*protected REPServerSocketChannel(SelectorProvider provider) {
+	protected REPServerSocketChannel(SelectorProvider provider) {
 		super(provider);
-	}*/
+	}
 	
 	public REPServerSocketChannel(ServerSocketChannel channel, REPPack<P> _packer){
 		super(SelectorProvider.provider());
-		//ss = channel;
+		ss = channel;
 		packer = _packer;
 	}
 
@@ -45,36 +45,34 @@
 		return new REPSocketChannel<P>(accept(), packer);
 	}
 
-	/*
 	@Override
 	public ServerSocket socket() {
-		return super.socket();
-	}*/
+		return ss.socket();
+	}
 
-	/*
 	@Override
 	protected void implCloseSelectableChannel() throws IOException {
 		ss.close();
-	}*/
-/*
+	}
+
 	@Override
 	protected void implConfigureBlocking(boolean block) throws IOException {
 		ss.configureBlocking(block);
-	}*/
+	}
 
 
 	public SelectionKey register(REPSelector sel, int ops, Object att) throws ClosedChannelException {
 		assert(!isSimulation);
 		REPSelector selector = sel;
 		if(sel!=null)
-			return selector.register(ss, ops, att);
+			return selector.register(this, ops, att);
 		else
 			return null;
 	}
 
 	@Override
 	public SocketChannel accept() throws IOException {
-		return (SocketChannel) accept1();
+		return null;//(SocketChannel) accept1();
 	}
 
 }
--- a/rep/channel/SelectorSimulator.java	Fri Aug 29 17:16:51 2008 +0900
+++ b/rep/channel/SelectorSimulator.java	Fri Aug 29 18:51:37 2008 +0900
@@ -40,12 +40,10 @@
 		}
 		return selectedKeys.size();
 	}
-	/*
-	public <T> SelectionKeySimulator register(SelectableChannelSimulator<T> cs, int opt){
-		SelectionKeySimulator key = new SelectionKeySimulator(cs, opt, this);
-		keyList.add(key);
-		return key;
-	}*/
+
+	public SelectionKeySimulator register(SelectableChannel cs, int opt){
+		return register(cs, opt, null);
+	}
 	public SelectionKeySimulator register(SelectableChannel cs, int opt, Object handler){
 		SelectionKeySimulator key = new SelectionKeySimulator(cs, opt, this);
 		key.attach(handler);