Commit Graph

245 Commits

Author SHA1 Message Date
Trustin Lee
8a672c2800 Proper assertion instead of blindly clearing the OutputMessageBuf 2013-04-04 14:11:24 +09:00
Norman Maurer
7ee2adb587 Move drain logic to OutputMessageBuf and optimize it as far as possible 2013-04-03 18:52:57 +02:00
Norman Maurer
1675e61f5b Share same ThreadLocal for all decoder/encoders to minimize memory usage 2013-04-03 18:19:35 +02:00
Norman Maurer
94ef7dc1b9 Optimize to minimize volatile reads to access next buffer in codec framework 2013-04-03 18:03:55 +02:00
Norman Maurer
9828267165 Fix performance regression which was caused by calling the fireInboundBufferUpdated() a way to often
* Also use a ThreadLocal for the decoder buffer to safe space as it is cheap
2013-04-03 17:07:52 +02:00
Norman Maurer
af4b71a00e Remove special handling of Object[] in codec framework (a.k.a unfolding)
- Fixes #1229
- Primarily written by @normanmaurer and revised by @trustin

This commit removes the notion of unfolding from the codec framework
completely.  Unfolding was introduced in Netty 3.x to work around the
shortcoming of the codec framework where encode() and decode() did not
allow generating multiple messages.

Such a shortcoming can be fixed by changing the signature of encode()
and decode() instead of introducing an obscure workaround like
unfolding.  Therefore, we changed the signature of them in 4.0.

The change is simple, but backward-incompatible.  encode() and decode()
do not return anything.  Instead, the codec framework will pass a
MessageBuf<Object> so encode() and decode() can add the generated
messages into the MessageBuf.
2013-04-03 21:44:54 +09:00
Norman Maurer
2e3b8f13ea Revert "Let ProtobufEncoder extend MessageToByteEncoder which makes more sense. Related to [#1222]"
This reverts commit 6a9d055f57.
2013-04-02 07:56:49 +02:00
Norman Maurer
6a9d055f57 Let ProtobufEncoder extend MessageToByteEncoder which makes more sense. Related to [#1222] 2013-04-02 07:17:45 +02:00
Norman Maurer
a0fca93128 [#1222] Correctly handle the case when a MessageToMessageEncoder encodes to ByteBuf and the next outbound buffer is of type ByteBuf 2013-04-02 07:17:10 +02:00
Prajwal Tuladhar
05850da863 enable checkstyle for test source directory and fix checkstyle errors 2013-03-30 13:18:57 +01:00
Trustin Lee
8b722d29a7 Add constructor parameters that do not perform type parameter auto-detection for the languages without type parameters
- Fixes #1177
- Add TypeParameterMatcher.get(parameterType)
- Add alternative constructors
2013-03-21 16:11:47 +09:00
Trustin Lee
97f2fa7341 Allow a user specify the byte order of the length field for LengthFieldBasedFrameDecoder
- Fixes #1164
2013-03-18 13:58:48 +09:00
Trustin Lee
e3d10ad493 Break the decode loop if decoder raises an exception to give a chance to close the connection to a user handler
- Fixes: #1161
2013-03-16 18:28:58 +09:00
Michael Nitschinger
b186342f52 Fixing 2 typos in codec documentation. 2013-03-16 17:18:21 +09:00
Trustin Lee
289d474a23 Make ByteArrayEncoder sharable 2013-03-14 17:44:32 +09:00
Trustin Lee
42e31a4445 Revert "[#1131] Codecs must not cache next buffer during processing"
This reverts commit b1775a3223.
2013-03-13 15:17:06 +09:00
Trustin Lee
c25513d5e1 Upgrade to protobuf 2.5 and take advantage of MessageLite.getParserFromType()
- also fall back to MessageBuilder if getParserFromType() is not available.
2013-03-12 16:25:35 +09:00
Trustin Lee
559b860ff6 Fix grammar 2013-03-12 15:23:09 +09:00
Trustin Lee
397830d238 Allow SingleOutboundMessageHandler.beginFlush() to reject the flush request by returning false / Replace PartialFlushException with IncompleteFlushException which is more correct. 2013-03-12 15:20:46 +09:00
Trustin Lee
c660002b4e Add DecoderResult.UNFINISHED to represent the case where a decoder generated a message that was not decoded completely / Remove partial failure in DecoderResult which is not very useful but confusing 2013-03-12 13:04:53 +09:00
Norman Maurer
806e9b1f8c Make sure we handle outbound messages of type ByteBuf special 2013-03-11 08:59:00 +09:00
Norman Maurer
b1775a3223 [#1131] Codecs must not cache next buffer during processing 2013-03-08 15:38:17 +01:00
Norman Maurer
fd3f923b52 Allow to specify the used buffer type for ChannelInboundByteBufHandler and ChannelOutboundByteBufHandler by configuration. As default it tries to use a direct ByteBuf 2013-03-08 08:20:46 +01:00
Trustin Lee
a9a29bdf3f Use I/O buffer whenever possible now that our direct buffers are as fast as heap buffers 2013-03-08 11:21:08 +09:00
Trustin Lee
88df53ec1a Fix infinite recursion when transferring data between different type of buffers / Add ByteBuf.hasMemoryAddress/memoryAddress()
- Fixes: #1109 and #1110
2013-03-06 18:22:16 +09:00
Trustin Lee
a8a7c4f576 Provide a way to implement an ChannelInbound/OutboundMessageHandler conveniently without extending an adapter class
- Add ChannelHandlerUtil and move the core logic of ChannelInbound/OutboundMessageHandler to ChannelHandlerUtil
- Add ChannelHandlerUtil.SingleInbound/OutboundMessageHandler and make ChannelInbound/OutboundMessageHandlerAdapter implement them.  This is a backward incompatible change because it forces all handler methods to be public (was protected previously)
- Fixes: #1119
2013-03-05 17:27:53 +09:00
Norman Maurer
42dad6d9d4 [#1106] Also handle FileRegion in ByteToByteEncoder and SslHandler 2013-02-28 19:40:34 +01:00
Trustin Lee
671f9d48d4 Use ConcurrentHashMapV8 wherever possible
- Fixes #1052
2013-02-26 15:54:51 -08:00
Luke Wood
e45db60b5e [#1069] Snappy decoding fixes
* Correct reading offset of 1-byte-offset copies
* Keep track of how much we've written so far in order to validate offsets
* Uncomment and reduce number of tests
2013-02-25 16:36:50 +00:00
Trustin Lee
58c72acd42 Add more failing tests to SnappyIntegrationTest 2013-02-22 10:06:24 -08:00
Luke Wood
f6d88ca5bf Use Short.MAX_VALUE, as it accurately represents what we're trying to limit ourselves to 2013-02-22 15:23:47 +00:00
Luke Wood
0bfa9159e3 Do not attempt to compress trailing data that is less than the MIN_COMPRESSIBLE_LENGTH 2013-02-22 14:24:50 +00:00
Luke Wood
7a8e9d7993 Ensure that at least 4 bytes are remaining in input buffer when compiling our hash table in search of duplicates, and restrict encoded frame sizes to 32,767 bytes (2^15 - 1) 2013-02-22 14:24:50 +00:00
Trustin Lee
17641d52fb Integrate @timboudreau's SnappyIntegrationTest improvements 2013-02-21 18:38:58 -08:00
Norman Maurer
c93f5afa99 [#1012] Cleanup 2013-02-20 12:52:55 +01:00
Atsuhiko Yamanaka
8fdf788cbd [#1012] Replace forked jzlib with official jzlib and add a test. 2013-02-20 12:49:05 +01:00
Trustin Lee
1011227b88 Remove apiviz tags - we are focusing on user guide instead and putting diagrams there 2013-02-14 12:09:16 -08:00
Norman Maurer
6983f704c0 Fix unreplayble error 2013-02-14 11:18:12 +01:00
Norman Maurer
5370573400 Change ReferenceCounted.retain* to return itself and so allow method chaining 2013-02-14 07:39:44 +01:00
Trustin Lee
53c27ef5ae More robust type parameter detection
- Also removed unnecessary constructors which were added due to incomplete type parameter detection logic
2013-02-13 19:02:55 -08:00
Luke Wood
c1783cc8d3 More fixes to snappy: * Make Snappy.decode stateful instead of relying on the uncompressed length being equal to the compressed length * Correctly handle copies where offset < length * Take copies from the output buffer in decoding * Make the maximum encoded chunk size 32kB for compressed data 2013-02-11 15:05:27 +01:00
Trustin Lee
b4f4b95739 Move io.netty.logging to io.netty.internal / Move Signal out of internal because we use it in Channel*MessageAdapters 2013-02-11 20:08:18 +09:00
Trustin Lee
a2e5cd94be Prettify APIviz / Tighten visibility / Move subclasses to top level / Remove unused UnknownSocksMessage 2013-02-11 19:42:23 +09:00
Trustin Lee
6c7bd6d174 Tighten visibility 2013-02-11 18:42:31 +09:00
Trustin Lee
d5105834d6 Hide SnappyChecksumUtil 2013-02-11 18:41:37 +09:00
Trustin Lee
2f1a0b0593 Remove freeInbound/OutboundMessage(), replaced by ReferenceCounted.retain/release()
- Related: #1029
2013-02-10 13:31:31 +09:00
Trustin Lee
b9996908b1 Implement reference counting
- Related: #1029
- Replace Freeable with ReferenceCounted
- Add AbstractReferenceCounted
- Add AbstractReferenceCountedByteBuf
- Add AbstractDerivedByteBuf
- Add EmptyByteBuf
2013-02-10 13:10:09 +09:00
Trustin Lee
46a249a26b Add more failing tests for Snappy codec 2013-02-10 00:33:41 +09:00
Trustin Lee
bd87284829 Clean up SnappyIntegrationTest / Fix checksum encoding 2013-02-10 00:20:49 +09:00
Trustin Lee
8bd7ea2f93 Fix SnappyFramedEncoderTest & SnappyFramedEncoder
- chunkLength is 3 bytes
2013-02-10 00:03:47 +09:00