Skip to content

Commit

Permalink
null point fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
TongxiJi committed Jun 30, 2018
1 parent aa8f84a commit 7c6d46c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/java/cn/wowspeeder/ss/SSTcpProxyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,18 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws E
.connect(clientRecipient)
.addListener((ChannelFutureListener) future -> {
if (future.isSuccess()) {
logger.debug("channel id {}, {}<->{}<->{} connect {}", clientCtx.channel().id().toString(), clientCtx.channel().remoteAddress().toString(), future.channel().localAddress().toString(), clientRecipient.toString(), future.isSuccess());
remoteChannel = future.channel();
if (clientBuffs != null) {
ListIterator<ByteBuf> bufsIterator = clientBuffs.listIterator();
while (bufsIterator.hasNext()) {
remoteChannel.writeAndFlush(bufsIterator.next());
try {
logger.debug("channel id {}, {}<->{}<->{} connect {}", clientCtx.channel().id().toString(), clientCtx.channel().remoteAddress().toString(), future.channel().localAddress().toString(), clientRecipient.toString(), future.isSuccess());
remoteChannel = future.channel();
if (clientBuffs != null) {
ListIterator<ByteBuf> bufsIterator = clientBuffs.listIterator();
while (bufsIterator.hasNext()) {
remoteChannel.writeAndFlush(bufsIterator.next());
}
clientBuffs = null;
}
clientBuffs = null;
} catch (Exception e) {
proxyChannelClose();
}
} else {
logger.error("channel id {}, {}<->{} connect {},cause {}", clientCtx.channel().id().toString(), clientCtx.channel().remoteAddress().toString(), clientRecipient.toString(), future.isSuccess(), future.cause());
Expand Down

0 comments on commit 7c6d46c

Please sign in to comment.