Browse Source

fixed message release handling in WrongUrlHandler. #384

master
Nikita 9 years ago
parent
commit
b86b49fbf1
  1. 6
      src/main/java/com/corundumstudio/socketio/handler/WrongUrlHandler.java

6
src/main/java/com/corundumstudio/socketio/handler/WrongUrlHandler.java

@ -23,15 +23,14 @@ import org.slf4j.LoggerFactory;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.DefaultHttpResponse;
import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.QueryStringDecoder; import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.util.ReferenceCountUtil;
@Sharable @Sharable
public class WrongUrlHandler extends ChannelInboundHandlerAdapter { public class WrongUrlHandler extends ChannelInboundHandlerAdapter {
@ -50,8 +49,9 @@ public class WrongUrlHandler extends ChannelInboundHandlerAdapter {
f.addListener(ChannelFutureListener.CLOSE); f.addListener(ChannelFutureListener.CLOSE);
req.release(); req.release();
log.warn("Blocked wrong socket.io-context request! url: {}, params: {}, ip: {}", queryDecoder.path(), queryDecoder.parameters(), channel.remoteAddress()); log.warn("Blocked wrong socket.io-context request! url: {}, params: {}, ip: {}", queryDecoder.path(), queryDecoder.parameters(), channel.remoteAddress());
return;
} }
ReferenceCountUtil.release(msg);
super.channelRead(ctx, msg);
} }
} }
Loading…
Cancel
Save