Commit Graph

4039 Commits

Author SHA1 Message Date
Trustin Lee
310a87a51d Fix #814 - Prevent IllegalBufferAccessException on write() and flush()
- Also fixed a incorrect port of SpdySessionHandler
  - Previously, it closed the connection too early when sending a GOAWAY frame
  - After this fix, SpdySessionHandlerTest now passes again without the previous fix
2012-12-18 04:53:37 +09:00
Norman Maurer
5a467b69bf DatagramPacket should be final 2012-12-17 20:37:10 +01:00
Trustin Lee
949435d105 Fix checkstyle 2012-12-18 03:08:01 +09:00
Trustin Lee
e59ac8e79b Do not call inbound event methods directly
- Fixes #831

This commit ensures the following events are never triggered as a direct
invocation if they are triggered via ChannelPipeline.fire*():

- channelInactive
- channelUnregistered
- exceptionCaught

This commit also fixes the following issues surfaced by this fix:

- Embedded channel implementations run scheduled tasks too early
- SpdySessionHandlerTest tries to generate inbound data even after the
  channel is closed.
- AioSocketChannel enters into an infinite loop on I/O error.
2012-12-18 03:04:26 +09:00
Norman Maurer
39250873ae Add some javadocs 2012-12-17 16:01:58 +01:00
Trustin Lee
3f9441f4c1 Add missing free() on SpdySessionHandler buffers 2012-12-17 19:29:36 +09:00
Trustin Lee
8b82ff5ce0 Fix checkstyle 2012-12-17 18:28:31 +09:00
Trustin Lee
a8f5efdb26 Add proper boundary / freeness check on ByteBuf impls
- Fixes #827
2012-12-17 18:27:30 +09:00
Trustin Lee
ca93b624ff Add IllegalBufferAccessException and checks on MessageBuf impls
- Related: #827
2012-12-17 18:03:31 +09:00
Trustin Lee
def12a171c Rename ChannelBuf to Buf and ChannelBufType to BufType
- Fixes #825
2012-12-17 17:43:45 +09:00
Trustin Lee
03e68482bb Remove ChannelBuf/ByteBuf.Unsafe
- Fixes #826
Unsafe.isFreed(), free(), suspend/resumeIntermediaryAllocations() are not that dangerous. internalNioBuffer() and internalNioBuffers() are dangerous but it seems like nobody is using it even inside Netty. Removing those two methods also removes the necessity to keep Unsafe interface at all.
2012-12-17 17:41:21 +09:00
Trustin Lee
33134b1343 Ensure PooledByteBuf.init() is not called with null memory 2012-12-17 16:02:21 +09:00
Norman Maurer
ba3c795fdf Adjust ChannelPipeline to support method-chaining in a consistent way 2012-12-14 17:06:31 +01:00
Norman Maurer
caa698f235 [#819] Allow for easy method-chaining in ChannelConfig and its sub-types
This commit also introduce a new interface which is called AioSocketChannelConfig to expose AIO only config options with the right visibility.
Also it change the ChannelConfig.setAllocator(..) to return the ChannelConfig to be more consistent with the other methods.
2012-12-14 16:59:23 +01:00
Norman Maurer
6eb7de04e7 Allow to access localAddress and remoteAddress even if the channel is not registered yet 2012-12-14 15:19:03 +01:00
Norman Maurer
42f6a27235 Allow modify the config even before the channel is registered to the eventLoop 2012-12-14 15:10:10 +01:00
Trustin Lee
d8c569a71b Make ChannelFutureNotifier accept multiple ChannelFutures 2012-12-14 20:09:40 +09:00
Trustin Lee
eb23c9d27c Add missing 'operation(args, future)' for 'operation(args)'
- Fixes #818
- Fix inspector warnings
2012-12-14 19:42:58 +09:00
Trustin Lee
5ffb495746 Do not allow suspendIntermediaryDeallocations() after free() 2012-12-14 18:39:00 +09:00
Norman Maurer
96dc3f983f Refactor AIO Transport to allow to use Bootstrap without the ugly hack 2012-12-14 09:51:36 +01:00
Trustin Lee
02a6e85feb Add methods that add/remove multiple ChannelFutureListeners to ChannelFuture
- Fixes #811
2012-12-14 12:45:43 +09:00
Trustin Lee
1f72e53af3 Remove redundant copyright headers added by IntelliJ 2012-12-14 12:23:24 +09:00
Trustin Lee
5a4a59406b Merge ByteBuf.hasNioBuffer() and hasNioBuffers()
- Fixes #797
2012-12-14 12:20:33 +09:00
Trustin Lee
8e1a6c6cf5 Add ByteBuf.maxWritableBytes()
- Fixes #806
2012-12-14 11:49:01 +09:00
Trustin Lee
9e973bbffc Port rebuildSelectors() from 3.6 to 4.0
- Fix #813
2012-12-14 11:43:04 +09:00
Trustin Lee
be6cc9c324 Fix inspection warnings 2012-12-14 11:23:30 +09:00
Trustin Lee
d1d9f131da Tell NioTask the cause of unregistration
- Add the 'cause' parameter to the channelUnregistered method
2012-12-14 11:18:03 +09:00
Norman Maurer
c4db51e85d Refactor AIO Transport to allow to use Bootstrap without the ugly hack 2012-12-13 19:54:39 +01:00
Trustin Lee
8945ce17ad Update license notices and dependencies 2012-12-14 00:38:05 +09:00
Trustin Lee
e37aeb38d6 Add the original copyright 2012-12-14 00:10:28 +09:00
Trustin Lee
6339feaa8f Apply advanced JVM options to benchmarks / Fix duplicate uploads
- Add common optimization options when launching a new JVM to run a benchmark
- Fix a bug where a benchmark report is uploaded twice
- Simplify pom.xml and move the build instruction messages to DefaultBenchmark
- Print an empty line to prettify the output
2012-12-14 00:00:41 +09:00
Trustin Lee
ad10518fca Fix the incorrect snapshot version number 2012-12-13 22:49:31 +09:00
Trustin Lee
b47fc77522 Add PooledByteBufAllocator + microbenchmark module
This pull request introduces the new default ByteBufAllocator implementation based on jemalloc, with a some differences:

* Minimum possible buffer capacity is 16 (jemalloc: 2)
* Uses binary heap with random branching (jemalloc: red-black tree)
* No thread-local cache yet (jemalloc has thread-local cache)
* Default page size is 8 KiB (jemalloc: 4 KiB)
* Default chunk size is 16 MiB (jemalloc: 2 MiB)
* Cannot allocate a buffer bigger than the chunk size (jemalloc: possible) because we don't have control over memory layout in Java. A user can work around this issue by creating a composite buffer, but it's not always a feasible option. Although 16 MiB is a pretty big default, a user's handler might need to deal with the bounded buffers when the user wants to deal with a large message.

Also, to ensure the new allocator performs good enough, I wrote a microbenchmark for it and made it a dedicated Maven module. It uses Google's Caliper framework to run and publish the test result (example)

Miscellaneous changes:

* Made some ByteBuf implementations public so that those who implements a new allocator can make use of them.
* Added ByteBufAllocator.compositeBuffer() and its variants.
* ByteBufAllocator.ioBuffer() creates a buffer with 0 capacity.
2012-12-13 22:35:06 +09:00
Norman Maurer
9d42acbc2a [#803] Make sure the right EventExecutor is used after re-register a Channel to another EventLoop 2012-12-13 10:38:44 +01:00
Veebs
0c5fd38eb6 #722 - Make WebSocketClientHandshakerFactory a static utility class 2012-12-13 07:34:05 +01:00
Veebs
2704efc056 Added documentation to websocket classes. 2012-12-13 07:13:46 +01:00
Norman Maurer
2903b91e66 [#798] Not call fireExceptionCaught(..) for outbound operations as the future will get notified anyway and so it is redundant.
Outbound operations are those which are part of the ChannelOutboundInvoker interface.
2012-12-10 20:12:59 +01:00
Norman Maurer
3e783e1b5e Fix bug in DefaultChannelHandlerContext where ByteBridge does not handle bounded buffers well 2012-12-10 16:47:24 +01:00
Trustin Lee
321b18d4d1 Fix test failures n LocalTransportThreadModelTest
testConcurrentMessageBufferAccess() assumes the outbound/inbound byte buffers are unbounded.  Because PooledByteBuf is bounded, the test did not pass.

The fix makes an assumption that ctx.flush() or fireInboundBufferUpdated() will make the next buffer consumed immediately, which is not the case in the real world.  Under network congestion, a user will see IndexOutOfBoundsException if the user's handler implementation writes boundlessly into inbound/outbound buffers.
2012-12-10 16:38:20 +01:00
Norman Maurer
bf8345999c Fix release of buffers in ByteToMessageCodec and MessageToMessageCodec 2012-12-08 12:59:32 +01:00
Norman Maurer
312810d415 [#795] Fix WebSocketClientHandshaker13 and WebSocketClientHandshaker08 finishHandshake() method. 2012-12-07 20:14:11 +01:00
Shawn Silverman
e5a8958ed6 Fixed some 120-character line checkstyle problems. 2012-12-07 06:31:21 +01:00
Shawn Silverman
8be43903e1 Added more Javadocs to the 'replace' methods, see Netty issue 756. 2012-12-07 06:31:21 +01:00
Norman Maurer
038bcfc4ff [#792] Implement freeInboundBuffer(...) and freeOutboundBuffer(...) methods in ByteToByteCodec 2012-12-06 20:57:08 +01:00
Norman Maurer
16b05def59 Fix possible NPE which accour if the inbound/outbound buffer was not lazy allocated yet 2012-12-06 19:36:53 +01:00
Trustin Lee
51e6519b67 Replace UnsafeByteBuf with ByteBuf.unsafe() again
* UnsafeByteBuf is gone. I added ByteBuf.unsafe() back.
* To avoid extra instantiation, all ByteBuf implementations implement the ByteBuf.Unsafe interface.
* To hide this implementation detail, all ByteBuf implementations are package-private.
* AbstractByteBuf and SwappedByteBuf are public and they do not implement ByteBuf.Unsafe because they don't need to.
* unwrap() is not an unsafe operation anymore.
* ChannelBuf also has unsafe() and Unsafe. ByteBuf.Unsafe extends ChannelBuf.unsafe(). ChannelBuf.unsafe() provides free() operation so that a user does not need to down-cast the buffer in freeInbound/OutboundBuffer().
2012-12-05 19:28:56 +09:00
Norman Maurer
a9af028077 [#787] Move the socks package to the right place 2012-12-04 09:14:05 +01:00
Trustin Lee
9c0b2ad75c Update netty-build to the latest version
From this commit, checkstyle considers an unnecessary empty line as a
violation.
2012-12-04 16:46:46 +09:00
Norman Maurer
85c570505b [maven-release-plugin] prepare for next development iteration 2012-12-03 20:34:05 +01:00
Norman Maurer
17d77ed160 [maven-release-plugin] prepare release netty-4.0.0.Alpha8 2012-12-03 20:33:49 +01:00