Commit Graph

304 Commits

Author SHA1 Message Date
Norman Maurer
ae76502040 [maven-release-plugin] prepare release netty-4.0.0.CR2 2013-05-08 18:19:38 +02:00
Norman Maurer
108c7d9b44 No need to pass the next BufType to the constructor 2013-05-06 07:46:26 +02:00
Norman Maurer
73c35aef4e [#1309] Make sure ReplayDecoder respect isSingleDecode()
* This could cause for example corrupt WebSocketFrame's if they was written from the server
  to the client directly after it send the handshake response.
2013-04-25 08:32:07 +02:00
Trustin Lee
7884574c7b Remove freeInboundBuffer() and freeOutboundBuffer() which has no value
- Fixes #1308

freeInboundBuffer() and freeOutboundBuffer() were introduced in the early days of the new API when we did not have reference counting mechanism in the buffer. A user did not want Netty to free the handler buffers had to override these methods.

However, now that we have reference counting mechanism built into the buffer, a user who wants to retain the buffers beyond handler's life cycle can simply return the buffer whose reference count is greater than 1 in newInbound/OutboundBuffer().
2013-04-25 09:15:55 +09:00
Trustin Lee
1b3d7f5325 Make sure handlerAdded() is called before forwarding the buffer content of the removed handler
- Added a test case that reproduces the problem in ReplayingDecoderTest
- Call newHandler.handlerAdded() *before* oldHandler.handlerRemoved() to ensure newHandlerAdded() is called before forwarding the buffer content of the old handler in replace0().
2013-04-24 19:25:43 +09:00
Trustin Lee
5dd35448a2 Add a failing test that will pass once #1306 is fixed 2013-04-24 18:47:36 +09:00
Trustin Lee
b5989e2449 Reduce exception instantiation overhead in SslHandler / Reduce unnecessary empty array creation
- Added EmptyArrays as an internal utility class
2013-04-24 09:32:53 +09:00
Trustin Lee
8e2e22c270 Change the thread model slightly for new/freeInbound/OutboundBuffer() for future improvement
- Related: #1283
- Make ReplayingDecoder work with the modified thread model
2013-04-23 13:06:27 +09:00
Norman Maurer
9c4bfa44d9 [#1294] Make sure ByteBuf is released once written to channel 2013-04-22 11:04:56 +02:00
Norman Maurer
ca5554dfe7 [#1236] Fix problem where adding a new ChannelHandler could block the eventloop
This change also introduce a few other changes which was needed:
 * ChannelHandler.beforeAdd(...) and ChannelHandler.beforeRemove(...) were removed
 * ChannelHandler.afterAdd(...) -> handlerAdded(...)
 * ChannelHandler.afterRemoved(...) -> handlerRemoved(...)
 * SslHandler.handshake() -> SslHandler.hanshakeFuture() as the handshake is triggered automatically after
   the Channel becomes active
2013-04-19 07:00:50 +02:00
Trustin Lee
4a5dc32224 Fix a bug where LineBasedFrameDecoder does not handle too long lines correctly
- Related: #1287
2013-04-19 13:04:20 +09:00
Andrei Pozolotin
a3e760a003 fix #1234 - duplicate package-info.java errors in eclipse requires release of netty-build v 19 and netty-parent update. 2013-04-05 05:38:05 +09:00
Trustin Lee
6dfa455f9e Fix compiler warnings 2013-04-04 16:31:41 +09:00
Trustin Lee
c03179c81c Clean up try/catch blocks / Prefer 'throw' to 'fireExceptionCaught' 2013-04-04 15:00:07 +09:00
Trustin Lee
3b9994455a Saner field order 2013-04-04 14:53:32 +09:00
Trustin Lee
03955428bc Ensure BufUtil.release() is called even if writeBytes() fails in writeAndRelease() 2013-04-04 14:50:25 +09:00
Trustin Lee
015e60b00f Clean up catch blocks
- No need to have nested try blocks because the catch block catches everything and rethrows it
- No need to do instanceof-checks
2013-04-04 14:48:30 +09:00
Trustin Lee
c25fd78ca0 No need to have nested try blocks
.. because the catch block catches everything and rethrows it
2013-04-04 14:44:52 +09:00
Trustin Lee
788b88b7af Make sure to release the buffer when it's written to the next byte buffer
.. otherwise it will leak.
2013-04-04 14:37:54 +09:00
Trustin Lee
46540578fc Optimize OutputMessageBuf.drainToNextInbound/Outbound()
- Return early when the buffer is empty
- Keep only the number of byte buffers
- Remove unnecessary null check in the loop (because we know buffer is not empty at certain point)
2013-04-04 14:32:48 +09:00
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
Norman Maurer
59012390f6 Fix version numbering 2013-03-25 08:01:11 +01:00
Norman Maurer
7d7b676eeb [maven-release-plugin] prepare for next development iteration 2013-03-22 15:20:35 +01:00
Norman Maurer
60fc7dac4d [maven-release-plugin] prepare release netty-4.0.0.CR1 2013-03-22 15:20:11 +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
2a87950784 [maven-release-plugin] prepare for next development iteration 2013-03-16 18:41:36 +09:00
Trustin Lee
adfb29330b [maven-release-plugin] prepare release netty-4.0.0.Beta3 2013-03-16 18:40:59 +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