package org.playorm.nio.impl.cm.readreg;
import java.io.IOException;
import org.playorm.nio.api.channels.Channel;
import org.playorm.nio.api.channels.RegisterableChannel;
import org.playorm.nio.api.channels.TCPChannel;
import org.playorm.nio.api.channels.TCPServerChannel;
import org.playorm.nio.api.handlers.ConnectionListener;
class RegProxyAcceptCb implements ConnectionListener {
private TCPServerChannel svrChannel;
private ConnectionListener cb;
public RegProxyAcceptCb(TCPServerChannel svrChannel, ConnectionListener cb) {
this.svrChannel = svrChannel;
this.cb = cb;
}
public void connected(Channel channel) throws IOException {
TCPChannel newChannel = new RegTCPChannel((TCPChannel) channel);
cb.connected(newChannel);
}
public void failed(RegisterableChannel channel, Throwable e) {
cb.failed(svrChannel, e);
}
}