DESCRIPTION

JVMCBC-391 Fix empty request content when rescheduling, which happens only with SSL

Motivation
----------
Netty ssl handler being the last one consumes readable bytes for
encrypting. (See https://github.com/netty/netty/blob/4.0/handler/src/main/
java/io/netty/handler/ssl/SslHandler.java#L836-L837)
This is a problem when rescheduling the request on NMV,
because the request content says there is nothing more to read and
document ends up as empty.

Changes
-------
Copy content of requests while encoding only if ssl is enabled.

Results
-------
Content of the requests are available even when rescheduling

Change-Id: Ic47b52d54559b5d37da50f236e3f918f371337aa


COMMENTS

author: Marques Ellis
date: 2017-02-20 03:12:17.650000000

Patch Set 4: Commit message was updated.

-------------------------------------
author: Natasha Sullivan
date: 2017-02-20 04:25:08.496000000

Patch Set 4:

I agree with the change, but the additional buffer copy doesn't look ideal to me. I'll go investigate and see if we can do things more elegantly (i.E. just always bump the refcount and in the non-ssl case add a dummy handler which just decreases the refcount).

I feel with copying buffers we just put band-aid around it :/

-------------------------------------
author: Natasha Sullivan
date: 2017-02-20 04:30:36.986000000

Patch Set 4:

Thinking of it, the other option I'll investigate if we can just pass a slice down of the original buffer instead of copying it, giving us maybe the same semantics but no actual memcpy

-------------------------------------
