File tree Expand file tree Collapse file tree 1 file changed +11
-15
lines changed
src/main/java/com/ning/http/client/providers/netty Expand file tree Collapse file tree 1 file changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -1024,23 +1024,19 @@ private void closeChannel(final ChannelHandlerContext ctx) {
1024
1024
private void finishChannel (final ChannelHandlerContext ctx ) {
1025
1025
ctx .setAttachment (DiscardEvent .INSTANCE );
1026
1026
1027
- // The channel may have already been removed if a timeout occurred, and this method may be called just after.
1028
- if (ctx .getChannel () == null ) {
1029
- return ;
1030
- }
1031
-
1032
- LOGGER .debug ("Closing Channel {} " , ctx .getChannel ());
1033
-
1034
- try {
1035
- ctx .getChannel ().close ();
1036
- } catch (Throwable t ) {
1037
- LOGGER .debug ("Error closing a connection" , t );
1038
- }
1027
+ Channel channel = ctx .getChannel ();
1039
1028
1040
- if (ctx .getChannel () != null ) {
1041
- openChannels .remove (ctx .getChannel ());
1029
+ // The channel may have already been removed if a timeout occurred, and this method may be called just after.
1030
+ if (channel != null ) {
1031
+ // FIXME can the context channel really be null?
1032
+ LOGGER .debug ("Closing Channel {} " , ctx .getChannel ());
1033
+ try {
1034
+ channel .close ();
1035
+ } catch (Throwable t ) {
1036
+ LOGGER .debug ("Error closing a connection" , t );
1037
+ }
1038
+ openChannels .remove (channel );
1042
1039
}
1043
-
1044
1040
}
1045
1041
1046
1042
@ Override
You can’t perform that action at this time.
0 commit comments