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

View file

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