Commit Graph

22 Commits

Author SHA1 Message Date
Fabien Renaud
73dae929e3 codec-memcache: copy metadata in binary full request response (#9160)
Motivations
-----------
Calling `copy()`, `duplicate()` or `replace()` on `FullBinaryMemcacheResponse`
or `FullBinaryMemcacheRequest` instances should copy status, opCode, etc.
that are defined in `AbstractBinaryMemcacheMessage`.

Modifications
-------------
 - Modified duplicate, copy and replace methods in
DefaultFullBinaryMemcacheRequest and DefaultFullBinaryMemcacheResponse
to always copy metadata from parent classes.
 - Unit tests verifying duplicate, copy and replace methods for
DefaultFullBinaryMemcacheRequest and DefaultFullBinaryMemcacheResponse
copy buffers and metadata as expected.

Result
------
Calling copy(), duplicate() or replace() methods on
DefaultFullBinaryMemcacheRequest or DefaultFullBinaryMemcacheResponse
produces valid copies with all expected metadata.

Fixes #9159
2019-05-22 11:06:16 +02:00
Norman Maurer
39aefdfa06 Fix buffer leaks in tests
Motivation:

While working on #6087 some buffer leaks showed up.

Modifications:

Correctly release buffers.

Result:

No more buffer leaks in memcache and stomp codec tests.
2016-12-03 20:11:25 +01:00
Xiaoyan Lin
a974fff07d Add regression tests for FullMemcacheMessageRequest and FullMemcacheMessageResponse
Motivation:

It's better to have some tests for FullMemcacheMessageRequest and FullMemcacheMessageResponse to avoid regression like #5197.

Modifications:

Add tests for FullMemcacheMessageRequest and FullMemcacheMessageResponse.

Result:

There are some basic tests for FullMemcacheMessageRequest and FullMemcacheMessageResponse.
2016-05-03 08:41:30 +02:00
Xiaoyan Lin
e053b96b5c Set the length fields of memcache messages automatically
Motivation:

People need to set all length fields manually when creating a memcache message and it's error prone. See #2736 for more dicussion.

Modifications:

This patch adds the logic to update the keyLength, extrasLength and totalBodyLength when key, extras or content is set.

Result:

The length fields of memcache messages will be updated automatically.
2016-04-07 06:30:42 +02:00
Xiaoyan Lin
36aa11937d ByteBuf for Key instead of String for codec-memcache
Motivation:

The key can be ByteBuf to avoid converting between ByteBuf and String. See #3689.

Modifications:

Replace the type of key with ByteBuf.

Result:

The type of key becomes ByteBuf.
2016-02-08 15:21:24 -08:00
Xiaoyan Lin
501c35afff Retain ByteBuf extras when aggregating
Motivation:

BinaryMemcacheObjectAggregator doesn't retain ByteBuf `extras`. So `io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1` will be thrown when aggregating a message containing `extras`. See the unit test for an example.

Modifications:

`ratain` extras to fix IllegalReferenceCountException.

Result:

`extras` is retained.
2016-01-29 22:24:07 +01:00
Xiaoyan Lin
4606890513 Retain AbstractBinaryMemcacheDecoder.currentMessage when sending it out and release it when it's not used.
Motivation:

AbstractBinaryMemcacheDecoder.currentMessage is not retained after sending it out. Hence, if a message contains `extras`, `io.netty.util.IllegalReferenceCountException` will be thrown in `channelInactive`.

Modifications:

Retain AbstractBinaryMemcacheDecoder.currentMessage After putting it to `out` and release it when it's not used.

Result:

No IllegalReferenceCountException or leak.
2016-01-29 14:15:49 +01:00
Trustin Lee
e556958abc Fix a buffer leak in BinaryMemcacheEncoderTest
BinaryMemcacheEncoderTest.shouldEncodeContent() did not release one of
the three buffers.
2015-08-29 11:54:01 +09:00
Trustin Lee
cde319dabd Adhere to our getter/setter naming rules
Motivation:

Persuit for consistent method naming across all classes

Modifications:

Remove 'get' prefix for the getter methods in codec-memcache

Result:

More consistent method naming
2014-06-24 16:10:32 +09:00
Michael Nitschinger
37ee6ef79a [codec-memcache] Simplify object hierachy and remove Headers.
This changeset removes the separate message headers and merges the
field directly into the messages. This greatly simplifies the
object hierachy and also saves header allocations in the pipeline.
2014-03-04 13:05:30 +01:00
Trustin Lee
df346a023b Change the return type of EmbeddedChannel.read*() from Object to an ad-hoc type parameter
.. so that there's no need to explicitly down-cast.

Fixes #2067
2014-02-13 17:19:26 -08:00
Michael Nitschinger
b17a765615 codec-memcache: prefix abstract classes with Abstract. 2014-02-13 17:09:21 -08:00
Trustin Lee
9840de82f0 Fix another buffer leak in BinaryMemcacheDecoderTest 2014-02-13 17:05:25 -08:00
Trustin Lee
b592a18cd1 Fix buffer leaks in BinaryMemcacheDecoderTest 2014-02-13 17:05:19 -08:00
Trustin Lee
acf7dbf811 Fix buffer leaks in BinaryMemcacheEncoderTest 2014-02-13 17:04:58 -08:00
Trustin Lee
fab56bae94 Fix a buffer leak in BinaryMemcacheObjectAggregatorTest 2014-02-13 17:03:05 -08:00
Trustin Lee
d417e3dbd0 Fix a buffer leak in BinaryMemcacheObjectAggregatorTest 2014-02-13 17:02:58 -08:00
Michael Nitschinger
a1526bedd3 codec-memcache: removed println in test case. 2014-02-13 16:51:45 -08:00
Michael Nitschinger
183bfe8f9f codec-memcache: fix decoding issue for value parts.
This changeset fixes an issue when decoding would stop if the value
comes separated in two or more packets, leading to invalid bytes read.
2014-02-13 16:51:37 -08:00
Trustin Lee
71b6439c66 Fixed various inspector warnings 2014-02-13 15:38:52 -08:00
Trustin Lee
3dd7fba320 Moved constant classes out of util 2014-02-13 15:38:20 -08:00
Michael Nitschinger
20f6f7e018 Implementing the Binary Memcache protocol
This changeset implements the full memcache binary protocol spec, including
a first batch of tests. Ascii protocol and more coverage and helper classes
will follow.
2014-02-13 15:29:38 -08:00