Fix for issue #456 related to payload using 2 differents RANDOM while only one should be used

This commit is contained in:
Frédéric Brégier 2012-07-18 11:43:36 +03:00
parent 00106b367c
commit 92334b919e

View File

@ -166,7 +166,7 @@ public class WebSocket08FrameEncoder extends MessageToByteEncoder<WebSocketFrame
if (maskPayload) { if (maskPayload) {
int random = (int) (Math.random() * Integer.MAX_VALUE); int random = (int) (Math.random() * Integer.MAX_VALUE);
mask = ByteBuffer.allocate(4).putInt(random).array(); mask = ByteBuffer.allocate(4).putInt(random).array();
out.writeInt((int) (Math.random() * Integer.MAX_VALUE)); out.writeInt(random);
int counter = 0; int counter = 0;
for (int i = data.readerIndex(); i < data.writerIndex(); i ++) { for (int i = data.readerIndex(); i < data.writerIndex(); i ++) {