Make sure SslHandler also works if SslBufferPool use non heap ByteBuffers. See #329
This commit is contained in:
parent
ef384a7b21
commit
a99f258984
@ -710,8 +710,14 @@ public class SslHandler extends FrameDecoder
|
|||||||
|
|
||||||
if (result.bytesProduced() > 0) {
|
if (result.bytesProduced() > 0) {
|
||||||
outNetBuf.flip();
|
outNetBuf.flip();
|
||||||
msg = ChannelBuffers.buffer(outNetBuf.remaining());
|
int remaining = outNetBuf.remaining();
|
||||||
msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
|
msg = ChannelBuffers.buffer(remaining);
|
||||||
|
|
||||||
|
// Transfer the bytes to the new ChannelBuffer using some safe method that will also
|
||||||
|
// work with "non" heap buffers
|
||||||
|
//
|
||||||
|
// See https://github.com/netty/netty/issues/329
|
||||||
|
msg.writeBytes(outNetBuf);
|
||||||
outNetBuf.clear();
|
outNetBuf.clear();
|
||||||
|
|
||||||
if (pendingWrite.outAppBuf.hasRemaining()) {
|
if (pendingWrite.outAppBuf.hasRemaining()) {
|
||||||
@ -850,7 +856,12 @@ public class SslHandler extends FrameDecoder
|
|||||||
if (result.bytesProduced() > 0) {
|
if (result.bytesProduced() > 0) {
|
||||||
outNetBuf.flip();
|
outNetBuf.flip();
|
||||||
ChannelBuffer msg = ChannelBuffers.buffer(outNetBuf.remaining());
|
ChannelBuffer msg = ChannelBuffers.buffer(outNetBuf.remaining());
|
||||||
msg.writeBytes(outNetBuf.array(), 0, msg.capacity());
|
|
||||||
|
// Transfer the bytes to the new ChannelBuffer using some safe method that will also
|
||||||
|
// work with "non" heap buffers
|
||||||
|
//
|
||||||
|
// See https://github.com/netty/netty/issues/329
|
||||||
|
msg.writeBytes(outNetBuf);
|
||||||
outNetBuf.clear();
|
outNetBuf.clear();
|
||||||
|
|
||||||
future = future(channel);
|
future = future(channel);
|
||||||
@ -993,7 +1004,12 @@ public class SslHandler extends FrameDecoder
|
|||||||
|
|
||||||
if (outAppBuf.hasRemaining()) {
|
if (outAppBuf.hasRemaining()) {
|
||||||
ChannelBuffer frame = ctx.getChannel().getConfig().getBufferFactory().getBuffer(outAppBuf.remaining());
|
ChannelBuffer frame = ctx.getChannel().getConfig().getBufferFactory().getBuffer(outAppBuf.remaining());
|
||||||
frame.writeBytes(outAppBuf.array(), 0, frame.capacity());
|
// Transfer the bytes to the new ChannelBuffer using some safe method that will also
|
||||||
|
// work with "non" heap buffers
|
||||||
|
//
|
||||||
|
// See https://github.com/netty/netty/issues/329
|
||||||
|
frame.writeBytes(outAppBuf);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user