Commit Graph

176 Commits

Author SHA1 Message Date
Norman Maurer
9228c97546 Tighten up visibility 2013-02-11 07:27:05 +01:00
Trustin Lee
4f6d05365a Fix a race condition in reference counter implementation / Reference count never goes below 0 2013-02-10 14:22:14 +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
affd514b8c Rename ByteBufUtil to BufUtil and move ChannelHandlerUtil.freeMessage() there / Remove ChannelHandlerUtil 2013-02-08 23:23:26 +09:00
Trustin Lee
d385cba41c Fix method naming / Make super method final 2013-02-08 17:08:58 +09:00
Trustin Lee
fa1b49de98 More robust automatic messageType detection for ChannelInboundMessageHandlerAdapter and MessageToMessageDecoder 2013-02-08 15:45:17 +09:00
Trustin Lee
e5616c85c4 Automatic messageType detection for ChannelInboundMessageHandlerAdapter 2013-02-08 13:48:47 +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
Norman Maurer
fd75615d7a [#870] Convert all modules into osgi bundles 2013-02-06 07:57:11 +01: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
2ec932798f Replace .readable() and .writable() to .isReadable() and .isWritable() 2013-01-31 18:24:33 +01:00
Trustin Lee
39357f3835 Enable TCP_NODELAY and SCTP_NODELAY by default
- Fixes #939
- Add PlatformDependent.canEnableTcpNoDelayByDefault()
  - Currently returns false on Android. Will change if necessary later.
2013-01-31 12:17:09 +09:00
Norman Maurer
57e504a7e6 Add javadocs to the *ChannelConfig interfaces to make clear which ChannelOptions implementations are expect to support 2013-01-20 08:10:15 +01:00
Norman Maurer
737a350854 Fix checkstyle 2013-01-17 09:30:57 +01:00
Trustin Lee
f568aa42f0 Hide the constructors of ChannelOption to force using dedicated option type 2013-01-17 14:14:41 +09:00
Norman Maurer
895bce6cd5 [#917] Move transport depending ChannelOption to the specific transport to make it consistent 2013-01-16 08:04:09 +01: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
Jestan Nirojan
49bf02ce09 [#929] Implemented multi-homing opertions in SctpServerChannels and SCTP Javadocs cleanup 2013-01-13 20:52:02 +01:00
Trustin Lee
3c9d912355 Use InetSocketAddress wherever possible / Tighten the return type of Channel.parent() 2013-01-10 14:17:54 +09:00
Trustin Lee
d5a7057c3f Fix inconsistent module name 2013-01-09 23:37:10 +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
dd6b7969b7 Give a handler more control over how its buffers' read bytes are discarded.
This pull request adds two new handler methods: discardInboundReadBytes(ctx) and discardOutboundReadBytes(ctx) to ChannelInboundByteHandler and ChannelOutboundByteHandler respectively. They are called between every inboundBufferUpdated() and flush() respectively. Their default implementation is to call discardSomeReadBytes() on their buffers and a user can override this behavior easily. For example, ReplayingDecoder.discardInboundReadBytes() looks like the following:

    @Override
    public void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
        ByteBuf in = ctx.inboundByteBuffer();
        final int oldReaderIndex = in.readerIndex();
        super.discardInboundReadBytes(ctx);
        final int newReaderIndex = in.readerIndex();
        checkpoint -= oldReaderIndex - newReaderIndex;
    }

If a handler, which has its own buffer index variable, extends ReplayingDecoder or ByteToMessageDecoder, the handler can also override discardInboundReadBytes() and adjust its index variable accordingly.
2013-01-09 13:34:09 +09:00
Norman Maurer
ccb5409f58 [#884] Split SCTP transport into extra module 2013-01-03 22:19:06 +01:00
Trustin Lee
528b5c4328 Removed the modules that are not part of 4.0.0.Alpha1
- Will add them back before Beta1 is out
2012-05-27 19:28:28 -07:00
Trustin Lee
92a688e5b2 Retrofit the codec framework with the new API (in progress)
- Replaced FrameDecoder and OneToOne(Encoder|Decoder) with:
  - (Stream|Message)To(String|Message)(Encoder|Decoder)
- Moved the classes in 'codec.frame' up to 'codec'
- Fixed some bugs found while running unit tests
2012-05-16 23:02:06 +09:00
Trustin Lee
894ececbb7 Convert DOS line ending to UNIX line ending 2012-05-15 17:14:02 +09:00
Trustin Lee
08137e2c49 Implement flush-future properly / Make channel options type-safe
- AbstractChannel keeps the expected number of written bytes so that
  the ChannelFuture of a flush() operation is notified on right timing.
  - Added ChannelBufferHolder.size() to make this possible
- Added AbstractChannel.isCompatible() so that only compatible EventLoop
  is accepted by a channel on registration
- Added ChannelOption to make channel options type-safe
- Moved writeSpinCount property to ChannelConfig and removed Nio*Config
- Miscellaneous cleanup

introducing
ChannelOption
2012-05-13 00:40:28 +09:00
Trustin Lee
368156f5d0 Another round of the new API design
- Channel now creates a ChannelPipeline by itself

  I find no reason to allow a user to use one's own pipeline
  implementation since I saw nobody does except for the cases where a
  user wants to add a user attribute to a channel, which is now covered
  by AttributeMap.

- Removed ChannelEvent and its subtypes because they are replaced by
  direct method invocation.
- Replaced ChannelSink with Channel.unsafe()
- Various getter renaming (e.g. Channel.getId() -> Channel.id())
- Added ChannelHandlerInvoker interface
- Implemented AbstractChannel and AbstractServerChannel
- Some other changes I don't remember
2012-05-01 17:19:41 +09:00
norman
db87c6ea37 Make sure Channel connected event is not fired on connect failure. See #249 2012-04-04 07:41:38 +02:00
norman
76c841bd4e Remove non-used class 2012-04-02 07:44:07 +02:00
norman
27836b6436 Add some package-info.java 2012-04-02 07:43:50 +02:00
norman
73bdaa113a Use jUnit Assume to "ignore" SCTP tests on non-unix operation systems 2012-04-02 07:35:42 +02:00
Norman Maurer
7dc2d8eb77 Make sure all resources are disposed before try to shutdown executor 2012-04-01 20:56:13 +02:00
Norman Maurer
f135804b9b Correct set blocking mode on server channel 2012-03-30 22:16:18 +02:00
Norman Maurer
8eb3a30bd4 Fix NPE 2012-03-30 22:07:27 +02:00
Norman Maurer
c83fb3a3f0 Correct handle interestedOps changes in Sctp 2012-03-30 21:59:48 +02:00
Norman Maurer
a2701a9ae4 Exclude com.sun.nio.* from the generated jar 2012-03-30 21:57:15 +02:00
Norman Maurer
8e9058e921 Enable/Disable sctp tests based on the detected OS 2012-03-30 21:57:01 +02:00
Norman Maurer
e3fa9810f8 Fix race 2012-03-30 16:24:08 +03:00
norman
a85f22e173 Code cleanup 2012-03-30 11:21:26 +02:00
norman
a60eecaa0c Refactor sctp to share code with nio 2012-03-30 11:07:43 +02:00
Trustin Lee
fd0b0a4e2b Code cleanup 2012-03-30 12:48:28 +09:00
Norman Maurer
6184456689 Fix usage of SctpNotificationHandler. See #245 2012-03-29 18:22:50 +02:00
norman
62028f0042 execute the wrapped Runnable 2012-03-07 14:15:42 +01:00
norman
6375b84c9d Change Worker.executeInIoThread() to not need a Channel as paramater 2012-03-07 14:13:48 +01:00
Jestan Nirojan
c40de99083 Merge remote branch 'upstream/master' 2012-03-05 20:56:45 +05:30
Norman Maurer
69e047ad2e Remove unused imports 2012-03-03 19:36:12 +01:00
Jestan Nirojan
5bbabb6dda fixed written bytes count in sctp send buffer pool 2012-03-03 11:45:50 +05:30
Norman Maurer
1589dadcce Better handling of canceling. See #210 and #209 2012-02-29 21:37:26 +01:00
Norman Maurer
a545157f4b Respect canceled tasks. See #209 and #210 2012-02-29 21:23:31 +01:00
Norman Maurer
8579f09c59 Merge pull request #210 from netty/threading_fix
Merge in fix for threading (related to #140 and #187). This also includes the new feature that allow to submit a Runnable that gets executed later in the io thread.
2012-02-29 12:11:46 -08:00
Norman Maurer
4df3c61233 Allow to submit a Runnable that get execute in the io-thread. This is
also used to workout flaws in the thread-model. See #209 #140 #187
2012-02-29 21:07:02 +01:00
Trustin Lee
4612568687 Fix #204 - Increate the granularity of connect timeout in NIO
* Changed the Selector timeout from 500 to 10 so that the timeout is checked every 10 milliseconds
2012-02-27 12:56:18 -08:00
Norman Maurer
b6700fbe58 Fix naming of class. Thanks Trustin for review 2012-02-27 20:46:40 +01:00
Norman Maurer
f2d1f1e8ad Also fix the exception handling if a ChannelHandler throws an Exception
based of if its a io thread or not. See #187 and #140
2012-02-25 15:54:33 +01:00
Norman Maurer
301a17c029 Rename method to better reflect its usage and update some javadocs. See
#187 and #140
2012-02-25 14:19:11 +01:00
Norman Maurer
c2bc463d61 Optimize the handling of fireEventLater if the current thread is the
worker thread. See #187 and #140
2012-02-24 22:03:32 +01:00
Norman Maurer
5fdd2dea12 Make it possible to schedule upstream events to get fired later in the
io-thread. This is the first part of #140 and #187
2012-02-24 20:26:50 +01:00
Dennis Boldt
b3cc305578 Organized imports. 2012-02-21 03:06:26 +01:00
Trustin Lee
a715220556 Fix a compilation error with the SCTP module in Mac 2012-02-20 16:04:46 -08:00
Jestan Nirojan
6eabd343c4 SCTP association shutdown cleanup 2012-02-20 01:39:42 +05:30
Jestan Nirojan
0bb1fe2656 Skipped SCTP Transport tests in the build (Java SCTP is only available for Linux and Solaris) 2012-02-19 13:30:24 +05:30
Jestan Nirojan
0148658bcc Merge branch 'master' of github.com:jestan/netty 2012-02-19 12:40:30 +05:30
Jestan Nirojan
20d7379c53 merge upstream master 2012-02-19 12:37:50 +05:30
norman
479def20bd Check if logging level is enabled before log. See #192 2012-02-17 10:37:41 +01:00
Jestan Nirojan
6d7ab72479 Corrected protocol identifier in SCTP test cases 2012-02-17 02:00:38 +05:30
Jestan Nirojan
4b99c4f4f7 1)set the selector select timout values equals to tcp nio transport
2)removed unsupported sctp socket options from SctpChannelConfig classes
3)added testcases for sctp multi homing and multi streaming
2012-02-17 01:52:24 +05:30
Jestan Nirojan
22a37e548e 1)implemented defragmenting sctp frame decoder 2)implemented sctp netty testsuite 2012-02-12 11:42:14 +05:30
Jestan Nirojan
fe3a480fb9 1)renamed sctp payload to sctp frame 2)added sctp codec, handler classes 2012-02-11 19:16:55 +05:30
Jestan Nirojan
a29d887c34 corrected sctp channel exception messages 2012-02-11 19:16:21 +05:30
Jestan Nirojan
71fd0231da cleanedup the sctp notification handler 2012-02-10 23:45:04 +05:30
Jestan Nirojan
af943b7502 fixed sctp write buffer watermark count 2012-02-10 23:33:59 +05:30
Trustin Lee
303c1b5f79 Overall cleanup / Add lost old jzlib headers 2012-01-13 17:41:18 +09:00
Trustin Lee
ebfc4513e0 Apply checkstyle to the build
Please note that the build will fail at the moment due to various checkstyle
violations which should be fixed soon
2012-01-11 20:16:14 +09:00
Trustin Lee
8663716d38 Issue #60: Make the project multi-module
Split the project into the following modules:
* common
* buffer
* codec
* codec-http
* transport
* transport-*
* handler
* example
* testsuite (integration tests that involve 2+ modules)
* all (does nothing yet, but will make it generate netty.jar)

This commit also fixes the compilation errors with transport-sctp on
non-Linux systems.  It will at least compile without complaints.
2011-12-28 19:44:04 +09:00