This commit is contained in:
Steven Smith 2015-08-21 20:52:17 -07:00
parent 83a5cb405c
commit 310de7c490
2 changed files with 8 additions and 0 deletions

View file

@ -93,9 +93,11 @@ public class TcpClientSession extends TcpSession {
future.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
System.err.println("Future start.");
if(!future.isSuccess()) {
exceptionCaught(null, future.cause());
}
System.err.println("Future end.");
}
}).await();
} catch(Throwable t) {
@ -106,6 +108,7 @@ public class TcpClientSession extends TcpSession {
if(wait) {
connectTask.run();
System.err.println("Connect completed.");
} else {
new Thread(connectTask).start();
}

View file

@ -308,13 +308,18 @@ public abstract class TcpSession extends SimpleChannelInboundHandler<Packet> imp
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
System.err.println("Channel active?");
if(this.disconnected || this.channel != null) {
ctx.channel().close();
return;
}
System.err.println("Channel active.");
this.channel = ctx.channel();
System.err.println("Channel set.");
this.packetHandleThread = new Thread(new Runnable() {
@Override
public void run() {