Commit Graph

39 Commits

Author SHA1 Message Date
Norman Maurer
e969b6917c Let CombinedChannelDuplexHandler correctly handle exceptionCaught. Related to [#4528]
Motivation:

ChannelInboundHandler and ChannelOutboundHandler both can implement exceptionCaught(...) method and so we need to dispatch to both of them.

Modifications:

- Correctly first dispatch exceptionCaught to the ChannelInboundHandler but also make sure the next handler it will be dispatched to will be the ChannelOutboundHandler
- Add removeInboundHandler() and removeOutboundHandler() which allows to remove one of the combined handlers
- Let *Codec extends it and not ChannelHandlerAppender
- Remove ChannelHandlerAppender

Result:

Correctly handle events and also have same behavior as in 4.0
2016-01-18 09:54:48 +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
Scott Mitchell
beab89bec5 Remove Erroneous imports
Motivation:
As part of merging / cherry-picking there were some Erroneous imports added to AbstractMemcacheObjectAggregator.

Modifications:
- Remove Imports from AbstractMemcacheObjectAggregator.

Result:
Code now builds.
2015-08-17 10:12:43 -07:00
Scott Mitchell
a7135e8677 HttpObjectAggregator doesn't check content-length header
Motivation:
The HttpObjectAggregator always responds with a 100-continue response. It should check the Content-Length header to see if the content length is OK, and if not responds with a 417.

Modifications:
- HttpObjectAggregator checks the Content-Length header in the case of a 100-continue.

Result:
HttpObjectAggregator responds with 417 if content is known to be too big.
2015-08-17 09:26:50 -07:00
JongYoonLim
3405aee2ab Returns after encoding each message not do check following instance types
Motivation:
Current AbstractMemcacheObjectEncoder does unnecessary message type checking if the message is MemcacheMessage type.

Modifications:
Returns after encoding MemcacheMessage message.

Result:
Small performance improvement for this encoder.
2015-03-19 20:43:59 +01:00
JongYoonLim
d5e67032b5 fix typo 2015-03-19 20:41:11 +01:00
Trustin Lee
d0912f2709 Fix most inspector warnings
Motivation:

It's good to minimize potentially broken windows.

Modifications:

Fix most inspector warnings from our profile
Update IntObjectHashMap

Result:

Cleaner code
2014-07-02 19:55:07 +09:00
Trustin Lee
33b9bc02ed Fix potential buffer leak in AbstractBinaryMemcacheDecoder
If a connection is closed unexpectedly while
AbstractBinaryMemcacheDecoder decodes a message, the half-constructed
message's content might not be released.
2014-06-24 16:25:40 +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
Trustin Lee
3c21b1cc43 Fix buffer leak in DefaultFullBinaryMemcacheRequest/Response
Motivation:

DefaultFullBinaryMemcacheRequest/Response overrides release(), retain(),
and touch() methods without calling its super, resulting in a leak of
the extras.

Modifications:

When overriding release(), retain(), and touch(), ensure to call super.

Result:

Fixes #2533 by fixing the buffer leak
2014-06-24 15:07:33 +09:00
Trustin Lee
8b0a0f9a8f Introduce MessageAggregator and DecoderResultProvider
Motivation:

We have different message aggregator implementations for different
protocols, but they are very similar with each other.  They all stems
from HttpObjectAggregator.  If we provide an abstract class that provide
generic message aggregation functionality, we will remove their code
duplication.

Modifications:

- Add MessageAggregator which provides generic message aggregation
- Reimplement all existing aggregators using MessageAggregator
- Add DecoderResultProvider interface and extend it wherever possible so
  that MessageAggregator respects the state of the decoded message

Result:

Less code duplication
2014-06-05 16:51:14 +09:00
Trustin Lee
d765f6b870 Synchronized between 4.1 and master (part 3)
Motivation:

4 and 5 were diverged long time ago and we recently reverted some of the
early commits in master.  We must make sure 4.1 and master are not very
different now.

Modification:

Fix found differences

Result:

4.1 and master got closer.
2014-04-25 16:17:59 +09:00
Michael Nitschinger
65ee10fbd0 [codec-memcache] Avoid NPE on channelInactive.
Motivation:
When no currentMessage has been set and the channel is inactive, a NPE is raised.

Modification:
Make sure that a currentMessage is available before checking the extras.

Result:
No more NPE raised potentially.
2014-04-23 11:41:44 +02: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
Michael Nitschinger
cd6b5def8d Always upstream full memcache messages.
This changeset is related to #2182, which exposes the failure in
the http codec, but the memcache codec works very similar. In addition,
better failure handling in the decoder has been added.
2014-02-24 10:42:17 +01:00
Trustin Lee
7e1db4feb7 Deprecate CombinedChannelDuplexHandler in favor of ChannelHandlerAppender
- Fixes #2233
2014-02-13 19:20:25 -08:00
Trustin Lee
8837afddf8 Enable a user specify an arbitrary information with ReferenceCounted.touch()
- Related: #2163
- Add ResourceLeakHint to allow a user to provide a meaningful information about the leak when touching it
- DefaultChannelHandlerContext now implements ResourceLeakHint to tell where the message is going.
- Cleaner resource leak report by excluding noisy stack trace elements
2014-02-13 18:16:25 -08:00
Trustin Lee
45e70d9935 Add ReferenceCounted.touch() / Add missing retain() overrides
- Fixes #2163
- Inspector warnings
2014-02-13 18:10:11 -08: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
Michael Nitschinger
fcb32a77b9 codec-memcache: No need to allocate a buffer if no extra is used. 2014-02-13 17:09:13 -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
ccd231b8f4 Fix a buffer leak in BinaryMemcacheDecoder 2014-02-13 17:05:05 -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
Trustin Lee
0ff98c98e2 readableBytes() ==0 -> !isReadable() 2014-02-13 16:56:35 -08:00
Trustin Lee
d31a3e4120 Hide protocol detail from users 2014-02-13 16:56:22 -08:00
Michael Nitschinger
215e75c7d9 codec-memcache: increase default buffer size and only encode extras if set. 2014-02-13 16:55:46 -08:00
Michael Nitschinger
f03c32e137 [codec-memcache] encode key directly, no need to use unpooled. 2014-02-13 16:51:51 -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
Michael Nitschinger
c78544cfaa Avoid memory leak when encoding the key 2014-02-13 16:36:09 -08:00
Trustin Lee
d748113c7d Abstract classes' names should start with 'Abstract' 2014-02-13 15:39:05 -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
Trustin Lee
a327a25a6c Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2014-02-13 15:37:16 -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