Commit Graph

214 Commits

Author SHA1 Message Date
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
Trustin Lee
3268781607 Fix SnappyFramedDecoderTest 2013-02-09 23:57:14 +09:00
Trustin Lee
319b7fa69a Fix SnappyFramedEncoder/Decoder / Fix Snappy preamble encoding / Add test for #1002
- The new test still fails due to a bug in Snappy.encode/decode()
2013-02-09 23:39:33 +09:00
Trustin Lee
36f8630512 Make SnappyFramedDecoder more robust against corrupt frame 2013-02-09 20:58:55 +09:00
Trustin Lee
affd514b8c Rename ByteBufUtil to BufUtil and move ChannelHandlerUtil.freeMessage() there / Remove ChannelHandlerUtil 2013-02-08 23:23:26 +09:00
Trustin Lee
44ea0a116f Replace ChannelHandlerUtil.unfoldAndAdd() with MessageBuf.unfoldAndAdd() / Remove unused methods in ChannelHandlerUtil 2013-02-08 23:07:20 +09:00
Trustin Lee
ff5aec0c78 Replace TypeParameterFinder with TypeParameterMatcher
- We can avoid reflective matching using byte code generation.
 - Better matching performance when message type is Object
2013-02-08 18:28:06 +09:00
Trustin Lee
01e65a01c7 Make ReplayingDecoder.newInboundBuffer/discardInboundReadByte() final for safety 2013-02-08 17:41:43 +09:00
Trustin Lee
82c46180c9 Tighten access modifier of encode/decode() 2013-02-08 17:37:16 +09:00
Trustin Lee
76eb40a4d2 Make ChannelOutboundMessageHandlerAdapter similar to ChannelInboundMessageHandlerAdapter 2013-02-08 17:07:01 +09:00
Trustin Lee
1640b1fea6 Automatically detect the message types in MessageToMessageCodec 2013-02-08 16:12:32 +09:00
Trustin Lee
fa1b49de98 More robust automatic messageType detection for ChannelInboundMessageHandlerAdapter and MessageToMessageDecoder 2013-02-08 15:45:17 +09:00
Trustin Lee
f9eff51683 Fix missing ChannelHandlerUtil.acceptedMessageTypes() in ByteToMessageCodec constructor 2013-02-08 13:24:27 +09:00
Trustin Lee
d8c0bf3be2 Add the 'nextBufferType' parameter to ByteArrayEncoder like did to StringEncoder / Consistent parameter order 2013-02-08 01:36:41 +09:00
Trustin Lee
d4742bbe16 Clean up abstract ChannelHandler impls / Remove ChannelHandlerContext.hasNext*()
- Rename ChannelHandlerAdapter to ChannelDuplexHandler
- Add ChannelHandlerAdapter that implements only ChannelHandler
- Rename CombinedChannelHandler to CombinedChannelDuplexHandler and
  improve runtime validation
- Remove ChannelInbound/OutboundHandlerAdapter which are not useful
- Make ChannelOutboundByteHandlerAdapter similar to
  ChannelInboundByteHandlerAdapter
- Make the tail and head handler of DefaultChannelPipeline accept both
  bytes and messages.  ChannelHandlerContext.hasNext*() were removed
  because they always return true now.
- Removed various unnecessary null checks.
- Correct method/field names:
  inboundBufferSuspended -> channelReadSuspended
2013-02-07 23:47:45 +09:00
Luke Wood
bfe44180f9 Fix SnappyFramedDecoder issues
- Checksum header was being incorrectly read due to incorrect order of
  shift and masking operations.
- Length field of 1-byte copy was being incorrectly interpreted due to a
  typo in the binary mask used to extract it.
- Use ByteBuf.readUnsignedByte() instead of readByte() & 0xff
- Use bitwise-OR wherever possible
- Use EmbeddedByteChannel to test
- Use ByteBuf comparison instead of array comparison
- Work done by @lw346 and then revised by @trustin
2013-02-01 13:10:34 +09:00
Trustin Lee
2ec932798f Replace .readable() and .writable() to .isReadable() and .isWritable() 2013-01-31 18:24:33 +01:00
Trustin Lee
42c65cca3a Make MessageBuf bounded
- Move common methods from ByteBuf to Buf
- Rename ensureWritableBytes() to ensureWritable()
- Rename readable() to isReadable()
- Rename writable() to isWritable()
- Add isReadable(int) and isWritable(int)
- Add AbstractMessageBuf
- Rewrite DefaultMessageBuf and QueueBackedMessageBuf
  - based on Josh Bloch's public domain ArrayDeque impl
2013-01-31 18:11:06 +01:00
Norman Maurer
ec013bf2d3 [#983] Force the user to implement an actual ChannelInboundHandler or ChannelOutboundHandler
For this ChannelInboundHandler* and ChannelOutboundHandler* was made package private
2013-01-31 15:50:27 +01:00
Luke Wood
bd0339ce1a Fix buffer over-run in Snappy codec when emitting a copy that leaves < 4 bytes remaining 2013-01-30 12:15:57 +01:00
Norman Maurer
291293a6dc [#980] Automatically trigger a read operation if isAutoRead() == false but we only had a partial decode 2013-01-30 09:16:45 +01:00
Norman Maurer
d7bfd44e10 [#982] [#977] [#858] Allow to transfer the content a ChannelHandlers inbound/outbound buffer on removal/replacement
This changes the behavior of the ChannelPipeline.remove(..) and ChannelPipeline.replace(..) methods in that way
that after invocation it is not possible anymore to access any data in the inbound or outbound buffer. This is
because it empty it now to prevent side-effects. If a user want to preserve the content and forward it to the
next handler in the pipeline it is adviced to use one of the new methods which where introduced.

 - ChannelPipeline.removeAndForward(..)
 - ChannelPipeline.replaceAndForward(..)
2013-01-28 10:25:38 +01:00
Norman Maurer
b9aaf9a167 [#977] Stop processing messages/bytes in a loop when the handler was removed from the ChannelPipeline 2013-01-23 07:35:44 +01:00
Norman Maurer
f2d84f75d6 [#952] Allow to switch to single message decoding mode on the fly 2013-01-18 09:56:12 +01:00
Trustin Lee
5a82dccbc5 Tighten visibility 2013-01-17 14:43:59 +09:00
Trustin Lee
64ae8b6a37 Replace and merge DetectionUtil and DirectByteBufUtil into PlatformDependent and PlatformDependent0
PlatformDependent delegates the operations requires sun.misc.* to PlatformDependent0 to avoid runtime errors due to missing sun.misc.* classes.
2013-01-11 14:03:27 +09:00
Norman Maurer
b742dcc209 [#902] Remove usage of generics for output of Encoder/Decoder to make them more flexible again 2013-01-09 07:13:31 +01:00
Trustin Lee
5d2e0688ab Fix checkstyle 2013-01-09 15:12:25 +09:00
Trustin Lee
5c2be33cae Delegate to the actual encoder/decoder if possible 2013-01-09 15:09:20 +09:00
Trustin Lee
102563ec8f No need to override ByteToMessageCodec.decoder.discardInboundReadBytes() 2013-01-09 15:05:03 +09:00
Trustin Lee
ef692b0c38 Add missing decodeLast() 2013-01-09 14:58:44 +09:00
Trustin Lee
b58a8f0106 Add missing codec operations in ByteToMessageCodec 2013-01-09 14:56:07 +09:00