Commit Graph

448 Commits

Author SHA1 Message Date
Norman Maurer
25e0d9de7e Allow the user to call slice().retain() or duplicate.retain() in his/her ByteToMessageDecoder.decode(...) method.
Motivation:
At the moment a user can not safetly call slice().retain() or duplicate.retain()in the ByteToMessageDecoder.decode(...) implementation without the risk to see coruption because we may call discardSomeReadBytes() to make room on the buffer once the handling is done.

Modifications:
Check for the refCnt() before call discardSomeReadBytes() and also check before call decode(...) to create a copy if needed.

Result:
The user can safetly call slice().retain() or duplicate.retain() in his/her ByteToMessageDecoder.decode(...) method.
2014-04-07 11:53:45 +02:00
Alexey Diomin
3b8da7db3f [#2339] Reduce memory usage in ProtobufVarint32LengthFieldPrepender
Motivation:

Reduce memory usage in ProtobufVarint32LengthFieldPrepender.

Modifications:

Explicit set the buffer size that is needed for the header (between 1 and 5 bytes).

Result:

Less memory usage in ProtobufVarint32LengthFieldPrepender.
2014-03-28 20:29:46 +01:00
Norman Maurer
a402b80ad0 Remove condition in ChannelHandlerAdapter.isSharable() by caching the result of the annotation lookup.
Motivation:
Remove the synchronization bottleneck and so speed up things

Modifications:
Introduce a ThreadLocal cache that holds mappings between classes of ChannelHandlerAdapater implementations and the result of checking if the @Sharable annotation is present.
This way we only will need to do the real check one time and server the other calls via the cache. A ThreadLocal and WeakHashMap combo is used to implement the cache
as this way we can minimize the conditions while still be sure we not leak class instances in containers.

Result:
Less conditions during adding ChannelHandlerAdapter to the ChannelPipeline
2014-03-12 13:43:39 +01:00
Norman Maurer
39929edbe4 Fix buffer leak in test which was introduced while implement ZLIB_OR_NONE support. Related to [#2269] 2014-03-10 06:26:39 +01:00
Norman Maurer
c47bbde1ad Fix buffer leak in test which was introduced while implement ZLIB_OR_NONE support. Related to [#2269] 2014-03-06 20:13:54 +01:00
Jakob Buchgraber
392dd288b1 Add ZLIB_OR_NONE support to JdkZlibDecoder [#2016] 2014-03-03 06:41:48 +01:00
Trustin Lee
0b1acf35c9 Fix resource leaks in ByteArrayEncoderTest 2014-02-16 11:51:27 -08:00
Vladimir Schafer
fc6fa2774e #2183 Fix for releasing of the internal cumulation buffer in ByteToMessageDecoder 2014-02-06 20:09:19 +01:00
Norman Maurer
ff771c0fcb Correctly calculate checksum when using GZIP. Part of [#2168] 2014-02-06 10:48:56 +01:00
Norman Maurer
cd5103feb7 [#2168] Eliminate unnessary memory copy for heap buffers in JdkZlibEncoder
* Also adjust tests so it test with direct and heap buffers
2014-01-30 06:29:52 +01:00
Trustin Lee
0f1b1be0aa 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-01-29 11:44:59 +09:00
Trustin Lee
b887e35ac2 Add ReferenceCounted.touch() / Add missing retain() overrides
- Fixes #2163
- Inspector warnings
2014-01-28 20:06:55 +09:00
Norman Maurer
1f049367a4 Make use of ByteBufProcessor for extract initial line and headers
This gives some nice performance boost as readByte() is quite expensive because of the index / replay checks.
2014-01-16 20:14:28 +01:00
Trustin Lee
f3a842ecca [maven-release-plugin] prepare for next development iteration 2013-12-22 22:06:15 +09:00
Trustin Lee
888dfba76f [maven-release-plugin] prepare release netty-5.0.0.Alpha1 2013-12-22 22:06:06 +09:00
Trustin Lee
94d6e44bba 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
2013-12-16 22:22:47 +09:00
Trustin Lee
6ddfab3c9c Fix another buffer leak in XmlFrameDecoderTest 2013-12-16 16:16:37 +09:00
Trustin Lee
40def86eb4 Fix buffer leaks in XmlFrameDecoderTest 2013-12-16 15:36:49 +09:00
Trustin Lee
e744926817 Fix inspector warnings 2013-12-16 14:45:57 +09:00
Mirko Caserta
5e851460a9 CDATA support 2013-12-16 14:43:07 +09:00
Mirko Caserta
c8bd76d9a9 Fixed the XML decoder 2013-12-16 14:43:07 +09:00
Trustin Lee
1084242df9 Add XML decoder
- based on @mcaserta's work at https://github.com/netty/netty/pull/1121
- not ready for a merge yet
2013-12-16 14:42:34 +09:00
Norman Maurer
643ce2f8c0 Fix all leaks reported during tests
- One notable leak is from WebSocketFrameAggregator
- All other leaks are from tests
2013-12-07 00:47:30 +09:00
Trustin Lee
8b495bb6e1 Fix bugs in ZLIB codec where they produce malformed stream or their streams are not flushed on time
- Fixes #2014
- Add the tests that mix JDK ZLIB codec and JZlib codecs
- Fix a bug where JdkZlibEncoder does not encode the GZIP header when nothing was written to te channel
- Fix a bug where the encoders do not consider the overhead of the wrapper format when calculating the estimated compressed output size.
- Fix a bug where the decoders do not discard the received data after the compressed stream is finished
2013-11-29 18:08:34 +09:00
Trustin Lee
110745b0eb Remove the distinction of inbound handlers and outbound handlers
- Fixes #1808
- Move all methods in ChannelInboundHandler and ChannelOutboundHandler up to ChannelHandler
- Remove ChannelInboundHandler and ChannelOutboundHandler
- Deprecate ChannelInboundHandlerAdapter, ChannelOutboundHandlerAdapter, and ChannelDuplexHandler
- Replace CombinedChannelDuplexHandler with ChannelHandlerAppender
  because it's not possible to combine two handlers into one easily now
- Introduce 'Skip' annotation to pass events through efficiently
- Remove all references to the deprecated types and update Javadoc
2013-11-27 17:31:28 +09:00
Trustin Lee
807d96ed6c Simplify bundle generation / Add io.netty.versions.properties to all JARs
- Fixes #2003 properly
- Instead of using 'bundle' packaging, use 'jar' packaging.  This is
  more robust because some strict build tools fail to retrieve the
  artifacts from a Maven repository unless their packaging is not 'jar'.
- All artifacts now contain META-INF/io.netty.version.properties, which
  provides the detailed information about the build and repository.
- Removed OSGi testsuite temporarily because it gives false errors
  during split package test and examination.
- Add io.netty.util.Version for easy retrieval of version information
2013-11-26 22:00:14 +09:00
Trustin Lee
26415b8f4c Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2013-11-04 19:42:33 +09:00
Trustin Lee
6b0025430e Bump the version to 5.0.0.Alpha1 2013-11-04 19:14:40 +09:00
Norman Maurer
208411f9a9 Also pass the ByteOrder in getUnadjustedFrameLength method. Part of #1960 2013-11-02 14:27:23 +01:00
Trustin Lee
f767abe5b0 Allow a user to define his/her own length field decoder
- Fixes #1960
2013-11-02 21:58:08 +09:00
Luke Wood
b31a1b2dca [#1958] Use CRC32-C in Snappy as per the spec 2013-11-01 20:53:16 +01:00
Trustin Lee
0dda7df344 Add a shortcut method for collision-free naming 2013-10-25 20:01:31 +09:00
Trustin Lee
dc009b2c2c Replace UniqueName with Constant and ConstantPool
- Proposed fix for #1824

UniqueName and its subtypes do not allow getting the previously registered instance.  For example, let's assume that a user is running his/her application in an OSGi container with Netty bundles and his server bundle.  Whenever the server bundle is reloaded, the server will try to create a new AttributeKey instance with the same name.  However, Netty bundles were not reloaded at all, so AttributeKey will complain that the name is taken already (by the previously loaded bundle.)

To fix this problem:

- Replaced UniqueName with Constant, AbstractConstant, and ConstantPool.  Better name and better design.

- Sctp/Udt/RxtxChannelOption is not a ChannelOption anymore.  They are just constant providers and ChannelOption is final now.  It's because caching anything that's from outside of netty-transport will lead to ClassCastException on reload, because ChannelOption's constant pool will keep all option objects for reuse.

- Signal implements Constant because we can't ensure its uniqueness anymore by relying on the exception raised by UniqueName's constructor.
2013-10-25 19:21:53 +09:00
Norman Maurer
5a844d0bd6 [#1812] Rework ByteToMessageDecoder.channelRead(..) method to allow for inlining 2013-10-24 07:15:40 +02:00
Norman Maurer
3de7a0bf76 Revert "[#1812] Rework ByteToMessageDecoder.channelRead(..) method to allow for inlining"
This reverts commit b7262ab3da.
2013-10-23 21:13:03 +02:00
Norman Maurer
b7262ab3da [#1812] Rework ByteToMessageDecoder.channelRead(..) method to allow for inlining 2013-10-23 19:54:24 +02:00
Norman Maurer
42cce12498 [#1907] LengthFieldPrepender should better extend MessageToMessageEncoder for less memory copies 2013-10-11 06:38:18 +02:00
Norman Maurer
522dbf8543 [#1906] Use a ByteBuf allocator from the ByteBufAllocator when encode Strings 2013-10-09 21:19:36 +02:00
Norman Maurer
f4edb2f689 [#1893] Fix bug in JdkZlibDecoder which did not let it handle large data 2013-10-07 08:07:53 +02:00
Norman Maurer
2ffdd92b56 [#1798] Correctly handle skipping of too big frames 2013-08-29 17:53:20 +02:00
Norman Maurer
5447fe1e59 Free up all buffers after the tests 2013-08-28 11:00:08 +02:00
Norman Maurer
cbf269e9b9 [#1788] Correctly decode CRC32 and ISIZE when using JdkZlibDecoder
Because of incorrect decoding a CompressionException was thrown before
2013-08-28 09:51:04 +02:00
Derek Troy-West
71acd96361 Currently the system variable to chose which type of zlib decoder is being negated 2013-08-27 08:27:18 +02:00
Norman Maurer
09a748abdb Bump up version to 4.1.0.Alpha1-SNAPSHOT 2013-08-26 15:18:18 +02:00
Norman Maurer
2e39b25cd4 [maven-release-plugin] prepare for next development iteration 2013-08-26 12:01:03 +02:00
Norman Maurer
b67659a866 [maven-release-plugin] prepare release netty-4.0.8.Final 2013-08-26 12:00:54 +02:00
Norman Maurer
65d24a7647 [#1735] Disable usage of JdkZlibDecoder by default, will be enabled in 4.1.0.Final 2013-08-26 08:15:30 +02:00
Norman Maurer
39cabcd36c [#1481] Add a JdkZlibDecoder which has no dependencies 2013-08-14 07:41:28 +02:00
Norman Maurer
7d31943326 Remove some dead code 2013-08-11 21:37:43 +02:00
Norman Maurer
73755d1233 [#1729] Let StringEncoder extend MessageToMessageEncoder and so safe a memory copy 2013-08-11 21:24:02 +02:00