Revert "Only parse the packet length one time per packet. See #382" as this makes no sense after thinking more about it and just makes it harder to read
This reverts commit 784722eff4540a2e81517c1b176f99e422385082. Conflicts: src/main/java/org/jboss/netty/handler/ssl/SslHandler.java
This commit is contained in:
parent
6421bd3885
commit
02c0c5b5e9
@ -206,8 +206,6 @@ public class SslHandler extends FrameDecoder
|
||||
|
||||
private final SSLEngineInboundCloseFuture sslEngineCloseFuture = new SSLEngineInboundCloseFuture();
|
||||
|
||||
private int packetLength = -1;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*
|
||||
@ -636,11 +634,12 @@ public class SslHandler extends FrameDecoder
|
||||
protected Object decode(
|
||||
final ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
|
||||
|
||||
if (packetLength == -1) {
|
||||
if (buffer.readableBytes() < 5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int packetLength = 0;
|
||||
|
||||
// SSLv3 or TLS - Check ContentType
|
||||
boolean tls;
|
||||
switch (buffer.getUnsignedByte(buffer.readerIndex())) {
|
||||
@ -702,8 +701,6 @@ public class SslHandler extends FrameDecoder
|
||||
}
|
||||
|
||||
assert packetLength > 0;
|
||||
}
|
||||
|
||||
|
||||
if (buffer.readableBytes() < packetLength) {
|
||||
return null;
|
||||
@ -725,11 +722,7 @@ public class SslHandler extends FrameDecoder
|
||||
// before calling the user code.
|
||||
final int packetOffset = buffer.readerIndex();
|
||||
buffer.skipBytes(packetLength);
|
||||
try {
|
||||
return unwrap(ctx, channel, buffer, packetOffset, packetLength);
|
||||
} finally {
|
||||
packetLength = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user