Fixed a race condition in HttpTunnelingServlet which caused data corruption and duplicate write

This commit is contained in:
Trustin Lee 2009-07-21 07:36:11 +00:00
parent a28d08936d
commit 8ed89dbd8f

View File

@ -240,8 +240,10 @@ public class HttpTunnelingServlet extends HttpServlet {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
buffer.readBytes(out, buffer.readableBytes());
out.flush();
synchronized (this) {
buffer.readBytes(out, buffer.readableBytes());
out.flush();
}
}
@Override