Commit Graph

108 Commits

Author SHA1 Message Date
Trustin Lee
cb4b673456 Disable AIO transport tests on Windows
- Related: #726
2013-02-05 17:06:56 +09:00
Norman Maurer
5b81e1692d Move non socket specific stuff out of the socket package, part 2 2013-02-01 10:32:27 +01:00
Trustin Lee
b1b0319bbe Fix build errors and warnings 2013-01-30 21:47:34 +09:00
Trustin Lee
03de5f479a Fix build errors 2013-01-30 21:43:37 +09:00
Jestan Nirojan
983a70805c Moved sctp transport classes from io.netty.channel.socket.sctp to it's own subpackage io.netty.channel.sctp 2013-01-14 21:27:49 +01:00
Trustin Lee
7755a82674 Revert mistakenly committed test change 2013-01-09 21:29:41 +09:00
Trustin Lee
b9352ded13 Fix a bug where prev/next context is not always set 2013-01-09 20:34:22 +09:00
Norman Maurer
bd093c4ab0 Don't spin the CPU so much in tests 2013-01-04 07:05:53 +01:00
Norman Maurer
712a6cfe8f Safe copy of buffer for test 2013-01-03 22:50:11 +01:00
Norman Maurer
ccb5409f58 [#884] Split SCTP transport into extra module 2013-01-03 22:19:06 +01:00
Trustin Lee
4a1aa37773 Re-ignore ServerSocketSuspendTest (unignored by mistake) 2013-01-03 17:07:30 +09:00
Trustin Lee
103edc4467 Make ChannelConfig.setAutoRead() triggers Channel.read() if autoRead was previously false
- also rename JDK socket and channel variables so that they are less ambiguous
2013-01-01 16:49:21 +09:00
Trustin Lee
7d80182e51 Fix a bug where SslHandler does not respect the startTls flag
- Fixes #856
- Add a dedicated test case: SocketStartTlsTest
2013-01-01 15:03:37 +09:00
Trustin Lee
2960af851a Extract the utility classes related with SSL to the util package 2013-01-01 14:04:37 +09:00
Trustin Lee
89a16fe01e Fix a bug in NIO transport where inboundBufferSuspended() is triggered even if the channel is closed.
- No non-static wildcard import
2013-01-01 00:35:44 +09:00
Trustin Lee
0909878581 Read only when requested (read-on-demand)
This pull request introduces a new operation called read() that replaces the existing inbound traffic control method. EventLoop now performs socket reads only when the read() operation has been issued. Once the requested read() operation is actually performed, EventLoop triggers an inboundBufferSuspended event that tells the handlers that the requested read() operation has been performed and the inbound traffic has been suspended again. A handler can decide to continue reading or not.

Unlike other outbound operations, read() does not use ChannelFuture at all to avoid GC cost. If there's a good reason to create a new future per read at the GC cost, I'll change this.

This pull request consequently removes the readable property in ChannelHandlerContext, which means how the traffic control works changed significantly.

This pull request also adds a new configuration property ChannelOption.AUTO_READ whose default value is true. If true, Netty will call ctx.read() for you. If you need a close control over when read() is called, you can set it to false.

Another interesting fact is that non-terminal handlers do not really need to call read() at all. Only the last inbound handler will have to call it, and that's just enough. Actually, you don't even need to call it at the last handler in most cases because of the ChannelOption.AUTO_READ mentioned above.

There's no serious backward compatibility issue. If the compiler complains your handler does not implement the read() method, add the following:

public void read(ChannelHandlerContext ctx) throws Exception {
    ctx.read();
}

Note that this pull request certainly makes bounded inbound buffer support very easy, but itself does not add the bounded inbound buffer support.
2012-12-31 23:26:00 +09:00
Norman Maurer
0fb0037eab Rename IpAddresses to NetUtil 2012-12-29 18:25:32 +01:00
Norman Maurer
5d13c7d27b Merge IPUtil and NetworkConstants into IpAddresses and also make naming of methods consistent 2012-12-29 18:17:33 +01:00
Norman Maurer
fdeff3855d Move ChannelInputShutdownEvent to socket package as this is where it belongs to. Also added some javadocs 2012-12-19 09:27:01 +01:00
Jestan Nirojan
4229b23a51 Fixed SCTP testcases #632 2012-12-19 06:51:00 +01: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
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
f9225df0a9 Add back support for FileRegion. See #668 2012-12-03 12:08:17 +01:00
Trustin Lee
74749ec15d Implement Bootstrap.toString() and use it in the testsuite
By implementing Bootstrap.toString() and printing it for each test case helps us figure out which transport is causing a trouble.
2012-11-26 16:14:24 +09:00
Trustin Lee
6f2840193a Fix inspection warnings related with JUnit usage 2012-11-12 12:45:06 +09:00
Trustin Lee
ea4a0e3535 Prefer {@code ...} to <code>...</code> / Fix deprecation warnings 2012-11-12 11:51:23 +09:00
Trustin Lee
f1e382c89d Fix compiler warnings related with SCTP detection 2012-11-12 09:53:44 +09:00
Trustin Lee
a07fb94fe7 Prefer "str".equals(var) to var.equals("str") / Add proper null checks 2012-11-12 08:59:54 +09:00
Trustin Lee
0b30bf613d More robust localhost resolution
Ensure the resolved localhost can be bound and connected actually
2012-11-10 08:45:07 +09:00
Trustin Lee
f77f13faf0 Make classes static wherever possible 2012-11-10 07:32:53 +09:00
Trustin Lee
c77bac44a2 Fix unchecked warnings 2012-11-10 07:29:14 +09:00
Trustin Lee
0d0eb0abfb Remove unused imports 2012-11-10 07:05:18 +09:00
Trustin Lee
b9fbed49bd Suppress false positives related with utility class inspections.
IntelliJ IDEA inspection for private utility classes seems flawed.
2012-11-10 06:53:34 +09:00
Trustin Lee
958d04a42b Remove redundant throws clauses / Suppress inspections for some false positives 2012-11-10 06:47:59 +09:00
Trustin Lee
58ba0de659 Remove unnecessarily qualified static access 2012-11-10 01:32:21 +09:00
Trustin Lee
96a769805b Fix utility classes - missing final modifiers etc 2012-11-09 17:44:40 +09:00
Norman Maurer
939ce47071 disable test for now 2012-10-27 21:13:46 +02:00
Norman Maurer
97038ea396 Disable test for now, as it behave different on different os. Will fix it after the alpha release 2012-10-27 20:57:54 +02:00
Norman Maurer
9551af6045 Skip Multicast test for OIO as it seems to fail because of a JDK bug on OSX 2012-10-27 20:51:21 +02:00
Norman Maurer
303fb80d34 Make sure the TestUtils class will also compile on operation systems that not support SCTP by using reflection 2012-10-13 17:04:16 +02:00
Norman Maurer
e9d2ebea3d Disable SCTP tests on platforms that not support them, also not run tests for sctp OIO. See #633 2012-10-13 09:19:01 +02:00
Jestan Nirojan
7afa237f3f Forward ported SCTP Echo Testcases 2012-09-30 14:14:34 +08:00
Trustin Lee
1bb5ac110f [#600] mvn clean package on OSX throws Exception
* Choose port randomly
* Ensure SO_REUSEADDR is not set at any case
* Ensure the port works for both wildcard and localhost
2012-09-28 16:27:23 +09:00
Trustin Lee
7c75dfb456 Remove System.err.printlns 2012-09-22 12:08:58 +09:00
Trustin Lee
0b71afb81c Improve the stability of ServerSocketSuspendTest 2012-09-22 12:05:00 +09:00
Norman Maurer
cc1e4d3bc7 Fix BindException on OSX. See #600 2012-09-14 07:22:02 +02:00
norman
df72356d7d Rename classes as result of descussion on #594 2012-09-12 14:04:41 +02:00
norman
ec1339d775 Finish the refactoring of bootstrap 2012-09-11 09:34:51 +02:00
Trustin Lee
a1e8dad4ad Fix a bug in shutdownOutput() implementations where wrong ChannelFuture is notified 2012-08-30 16:38:08 +09:00
Trustin Lee
b4643c42aa Ensure ChannelInputShutdownEvent is triggered only once 2012-08-30 13:35:34 +09:00