Commit Graph

30 Commits

Author SHA1 Message Date
Trustin Lee
61314ef51b Split AbstractChannel.doFlush() into two variants for simpler user impl
- Also renamed doRead() to doReadMessages() and doReadBytes()
2012-05-25 15:32:28 -07:00
Trustin Lee
59f11ed64f Optimize AbstractChannel and related classes
- AbstractChannel.doRead() is split into two versions so that the
  implementation doesn't have to validate the buffer type.
- Optimized ChannelBufferHolder a little bit
- Reduced GC related with flush future notification
  - Added FlushCheckpoint and DefaultChannelFuture implements it
    opportunistically
-
2012-05-25 06:16:25 -07:00
Trustin Lee
c6f3b5762e Implement NIO datagram transport with the new API
- AbstractChannel now handles flushing a message buffer
- Cleaned up DatagramChannel interface
- Removed ProtocolFamily because a user can create an NIO
  DatagramChannel and specify it as a constructor parameter
- UniqueName and UniqueKey constructors became public so that
  I don't need to create a subclass every time.
2012-05-24 08:57:10 -07:00
Trustin Lee
cab983244d Tidy up AbstractChannel.read() 2012-05-20 15:03:28 +09:00
Trustin Lee
3a8c10cc5a Do not call expandReadBuffer too often 2012-05-20 14:30:26 +09:00
Trustin Lee
af37ec4f23 Ported the HTTP snoop example to the new API
- Replaced pipeline factories with initializers
- Ported essential parts related with HTTP to the new API
- Replaced ChannelHandlerAdapter.combine() with CombinedChannelHandler
- Fixed a bug where ReplayingDecoder does not notify the next handler
- Fixed a bug where ReplayingDecoder calls wrong callDecode() method
- Added a destination buffer as an argument to AbstractChannel.doRead()
  for easier implementation
- Fixed a bug where NioSocketChannel did not try to increase the inbound
  buffer size (moved the logic to AbstractChannel)
2012-05-20 14:19:11 +09: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
dd2e36e5d9 Remove unused or unmaintainable internal classes 2012-05-15 17:10:54 +09:00
Trustin Lee
311f17f6ef Replace Bootstrap with ChannelBuilder and ServerChannelBuilder
- Added ChannelInitializer which is supposed to be used with the
  builders
- Echo examples use ChannelBuilder and ServerChannelBuilder now
- Replace ChannelFuture.rethrowIfFailed() with sync*()
- Bug fixes
2012-05-14 23:57:23 +09:00
Trustin Lee
05f955ee10 Clean up echo example / Fix a bug where closeFuture is not notified 2012-05-14 14:17:40 +09:00
Trustin Lee
3642879d98 Move up write spinning from SelectorEventLoop to AbstractChannel 2012-05-13 05:09:05 +09:00
Trustin Lee
6d14fac99c Revive Channel.closeFuture
- ChannelPipeline now rejects an unsafe ChannelFuture, so there's no
  need to hide/remove closeFuture.
2012-05-13 01:37:16 +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
4b673c4ebb Fix infinite loop while handling a client socket / Retrofit EchoClient 2012-05-11 21:19:19 +09:00
Trustin Lee
b4610acda1 Implement connect timeout
- Merged ClientChannelConfig back to ChannelConfig
- AbstractChannel handles connect timeout making use of
  EventLoop.schedule()
2012-05-11 20:44:00 +09:00
Trustin Lee
a4678a6030 Close all channels when SelectorEventLoop shuts down
- Also removed a FIXME which was fixed already
2012-05-11 11:01:44 +09:00
Trustin Lee
f6d6d1282c Simplify AbstractChannel.toString() 2012-05-11 10:47:45 +09:00
Trustin Lee
2134848111 Ensure the specified future has the correct channel / Cleanup 2012-05-11 09:00:35 +09:00
Trustin Lee
cb718a07c8 Move ChannelFutureFactory.newVoidFuture() to Channel.Unsafe() / Cleanup 2012-05-11 00:57:42 +09:00
Trustin Lee
da9ecadfc0 Introduce bypass buffer and use it in LoggingHandler
- Added ChannelBufferHolders.(inbound|outbound)BypassBuffer()
  - The holder returned by these methods returns the next handler's
    buffer.  When a handler's new(Inbound|Outbound)Buffer returns
    a bypass holder, your inboundBufferUpdated() and flush()
    implementation should check if the buffer is a bypass and should not
    modify the content of the buffer.
- Channel(Inbound|Outbound)?HandlerAdapter is now abstract.
  - A user has to specify the exact inbound/outbound buffer type
  - It's because there's no way to determine the best buffer type
- Implemented LoggingHandler using the new API.
  - It doesn't dump received or sent messages yet.
- Fixed a bug where DefaultUnsafe.close() does not trigger deregister()
- Fixed a bug where NioSocketChannel.isActive() does not return false
  when closed
2012-05-10 23:19:59 +09:00
Trustin Lee
532672deae Fix unnecessary application of Math.abs() 2012-05-10 21:56:10 +09:00
Trustin Lee
b4764f6164 Fix infinity loop and timing issues
- Made sure unnecessary interestOps are not OR'd
- Fixed a bug where DefaultChannelFuture.rethrowIfFailed() returns
  silently if the future is not done yet - there's no ways to tell
  the differences between failure and incompleteness.
2012-05-09 23:42:01 +09:00
Trustin Lee
129a2af86a Initial working version of the echo server example
- Optimized AbstractChannelBuffer.discardReadBytes()
- Split ChannelHandlerInvoker into ChannelInboundInvoker and
  ChannelOutboundInvoker
  - Channel implements ChannelOutboundInvoker
  - ChannelOutboundInvoker.nextOut() is now out()
  - ChannelOutboundHandlerContext.out() is now prevOut()
  - Added the outbound operations without future
    parameter to ChannelOutboundInvoker for user convenience
- All async operations which requires a ChannelFuture as a parameter
  now returns ChannelFuture for user convenience
- Added ChannelFutureFactory.newVoidFuture() to allow a user specify
  a dummy future that is of no use
  - I'm unsure if it is actually a good idea to introduce it. It might
    go away later.
- Made the contract of AbstractChannel.doXXX() much simpler and moved
  all common code up to AbstractChannel.DefaultUnsafe
- Added Channel.isOpen()
- Fixed a bug where MultithreadEventLoop always shut down its child
  event loops on construction
- Maybe more changes I don't remember :-)
2012-05-09 22:09:06 +09:00
Trustin Lee
607d784e5e Retrofit/overhaul the NIO transport with the new API
- Remove large portion of code thanks to the new API
- SocketChannel implementations are instantiated without factories
- Retrofit the existing code with the new API
2012-05-02 21:05:53 +09:00
Trustin Lee
9e6f8b46df Retrofit the NIO transport with the new API / improve the new API
- Remove the classes and properties that are not necessary anymore
- Remove SingleThreadEventLoop.newRegistrationTask() and let
  Channel.Unsafe handle registration by itself
- Channel.Unsafe.localAddress() and remoteAddress()
  - JdkChannel is replaced by Channel.Unsafe.
2012-05-02 15:01:58 +09:00
Trustin Lee
e65e496fc0 Clear Channel.eventLoop on deregistration 2012-05-01 23:19:31 +09:00
Trustin Lee
1356a0b61e Replace Channel.Unsafe.setEventLoop() with register()
- Added AbstractChannel.doRegister()
2012-05-01 23:18:29 +09:00
Trustin Lee
825d7964c9 Add ChannelFutureFactory & removeClosureListener()
- Channel and ChannelHandlerContext extends ChannelFutureFactory.
- Added Channel.removeClosureListener()
2012-05-01 17:48:24 +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
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