Fixed a bug where DiscardClientHandler.transferredBytes are always zero
This commit is contained in:
parent
102b69d14f
commit
eed6e6cc3a
@ -30,6 +30,7 @@ import org.jboss.netty.channel.ChannelStateEvent;
|
|||||||
import org.jboss.netty.channel.ExceptionEvent;
|
import org.jboss.netty.channel.ExceptionEvent;
|
||||||
import org.jboss.netty.channel.MessageEvent;
|
import org.jboss.netty.channel.MessageEvent;
|
||||||
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
|
||||||
|
import org.jboss.netty.channel.WriteCompletionEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a client-side channel.
|
* Handles a client-side channel.
|
||||||
@ -87,7 +88,11 @@ public class DiscardClientHandler extends SimpleChannelUpstreamHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
|
||||||
// Server is supposed to send nothing. Therefore, do nothing.
|
// Server is supposed to send nothing. Therefore, do nothing.
|
||||||
transferredBytes.addAndGet(((ChannelBuffer) e.getMessage()).readableBytes());
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeComplete(ChannelHandlerContext ctx, WriteCompletionEvent e) {
|
||||||
|
transferredBytes.addAndGet(e.getWrittenAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user