Commit Graph

285 Commits

Author SHA1 Message Date
Trustin Lee
876847fd20 Merge MessageBufs and ByteBufs into Unpooled
- e.g. Unpooled.messageBuffer()
- It will make much more sense once we introduce pooling:
  - i.e. Pooled.buffer()
2012-06-11 17:02:29 +09:00
Trustin Lee
d27a27c980 Fix a bug where channelInactive() is not triggered for local transport 2012-06-11 11:59:00 +09:00
Trustin Lee
cf0259661e Fix a race condition where local channel's closeFuture is notified early
- Added AbstractChannel.doPreClose() to allow a transport to perform
  a task before closeFuture is notified
2012-06-11 11:53:43 +09:00
Trustin Lee
632542e0cd Make a CPU-intensive test pass on a slow machine 2012-06-11 11:42:11 +09:00
Trustin Lee
f3bbb7291e Remove a bad assertion 2012-06-11 11:39:44 +09:00
Trustin Lee
9dce123938 Use MessageBuf instead of Queue wherever possible in channel API 2012-06-11 10:43:47 +09:00
Norman Maurer
ad4f05f5d6 Add missing license headers 2012-06-10 20:31:31 +02:00
Trustin Lee
574d84e98e Remove ChannelBufferHolder / Add more handler interfaces for type safety
- ChannelInboundHandler and ChannelOutboundHandler does not have a type
  parameter anymore.  
- User should implement ChannelInboundMessageHandler or
  ChannelOutboundMessageHandler.
2012-06-10 12:22:32 +09:00
Trustin Lee
a849d11877 ChannelBuffers -> ByteBufs / Add MessageBuf & ChannelBuf
- Add MessageBuf which replaces java.util.Queue
- Add ChannelBuf which is common type of ByteBuf and ChannelBuf
- ChannelBuffers was renamed to ByteBufs
- Add MessageBufs
- All these changes are going to replace ChannelBufferHolder.
2012-06-10 11:31:39 +09:00
Trustin Lee
5164d91255 Rename ChannelBuffer to ByteBuf as discussed before
- ChannelBuffer gives a perception that it's a buffer of a
  channel, but channel's buffer is now a byte buffer or a message
  buffer.  Therefore letting it be as is is going to be confusing.
2012-06-10 11:08:43 +09:00
Trustin Lee
87f52aa604 Ensure that a user implements flush() or inboundBufferUpdated()
- Also prohibited a user from overriding
  ChannelInbound(Byte|Message)HandlerAdapter.  If a user wants to do
  that, he or she should extend ChannelInboundHandlerAdapter instead.
2012-06-10 10:48:11 +09:00
Trustin Lee
e376888d48 Replace 'Stream' with 'Byte'
- In computing, 'stream' means both byte stream and message stream,
  which is confusing.
- Also, we were already mixing stream and byte in some places and
  it's better use the terms consistently.
  (e.g. inboundByteBuffer & inbound stream)
2012-06-09 21:05:59 +09:00
Trustin Lee
24e1f936a8 ChannelType -> ChannelBufferType / Optimize DefaultChannelPipeline
- Channel.type() -> bufferType()
- Use simpler bit mask operation for pipeline traversal
2012-06-09 09:44:30 +09:00
Trustin Lee
5661bff062 Rename SocketAddresses to NetworkConstants 2012-06-09 08:44:56 +09:00
Trustin Lee
a507ea97ef Move some logic from DefaultChannelPipeline to DefaultChannelHandlerContext
- Using the fact that head is always non-null, we can remove some code
  in DefaultChannelPipeline and move some to
  DefaultChannelHandlerContext
2012-06-08 23:11:15 +09:00
Trustin Lee
468a3228a4 Fit every line into 120 columns 2012-06-08 19:28:12 +09:00
Trustin Lee
353357fbd5 Moved AsyncPipelineModification to a new file 2012-06-08 12:44:47 +09:00
Trustin Lee
493e77a5a7 Remove trailing whitespace 2012-06-08 11:14:47 +09:00
Trustin Lee
8970ee751c Fix a weird compilation error in DefaultChannelPipeline
probably a compiler bug - working around
2012-06-08 10:57:38 +09:00
Trustin Lee
50fafdc3d3 Rewrite SslHandler / Reduce the chance of OIO-OIO dead lock
- SslHandler always begins handshake unless startTls is true
  - Removed issueHandshake property
  - If a user wants to start handshake later, he/she has to add 
    SslHandler later.
- Removed enableRenegotiation property
  - JDK upgrade fixes the security vulnerability - no need to complicate
    our code
- Some property name changes
  - getSSLEngineInboundCloseFuture() -> sslCloseFuture() 
- Updated securechat example
- Added timeout for handshake and close_notify for better security
  - However, it's currently hard-coded.  Will make it a property later.
2012-06-08 01:22:35 +09:00
Trustin Lee
4a23c2a6eb Fix checkstyle errors 2012-06-07 22:01:59 +09:00
Trustin Lee
10f7a31908 Fixed SpdySessionHandlerTest / Fixed NPE in EmbeddedChannel
- Some tests like SpdySessionHandlerTest accesses outbound buffer
  even before the outbound buffer is initialized by
  AbstractEmbeddedChannel's subclasses, leading to NPE at <init>.
  To fix this problem, subclasses now pass the outbound buffer as
  a constructor parameter to AbstractEmbeddedChannel.
2012-06-07 21:33:31 +09:00
Trustin Lee
994038975a Port HttpContentEncoder/Decoder to use EmbeddedStreamChannel / Cleanup
- Removed unused constructor parameter in AbstractChannel
- Re-enabled GZIP encoding in HTTP snoop example
2012-06-07 21:06:56 +09:00
Trustin Lee
3442ff90e8 Ported all tests in netty-codec to the new embedder 2012-06-07 20:17:26 +09:00
Trustin Lee
7bc10f2eba Replace codec embedder with EmbeddedChannel which can test any handlers
- Added EventExecutor.inEventLoop(Thread) and replaced executor identity
  comparison in DefaultChannelPipeline with it - more elegant IMO
- Removed the test classes that needs rewrite or is of no use
2012-06-07 19:39:37 +09:00
Trustin Lee
8701e24b9a Add back Channel(Inbound|Outbound)(Message|Stream)HandlerAdapter
- they are useful when creating an anonymous class
- Also added back CombinedChannelHandler with extra constraints
2012-06-07 17:49:45 +09:00
Trustin Lee
aab71ccd8a Remove Channel(Inbound|Outbound)HandlerAdapter which does nothing
- Thanks to the recent refactoring, Channel(Inbound|Outbound)Handler-
  Adapter ended up having empty body.  No need to keep.
2012-06-07 17:25:15 +09:00
Trustin Lee
09570db091 Fixed a bug where ChannelInitializer can trigger the same event twice 2012-06-07 17:06:13 +09:00
Trustin Lee
6b819fb993 Fix a NPE in DefaultChannelPipeline.write(...)
- Also re-enabled logging handler in the echo example
2012-06-07 17:00:21 +09:00
Trustin Lee
ea0c9cfe79 Post-overhaul fixes / Split LoggingHandler into three
- LoggingHandler now only logs state and operations
- StreamLoggingHandler and MessageLoggingHandler log the buffer content
- Added ChannelOperationHandlerAdapter
  - Used by WriteTimeoutHandler
2012-06-07 16:56:21 +09:00
Trustin Lee
5e93d206ff Overhaul - Split ChannelHandler & Merge ChannelHandlerContext
- Extracted some handler methods from ChannelInboundHandler into
  ChannelStateHandler
- Extracted some handler methods from ChannelOutboundHandler into
  ChannelOperationHandler
- Moved exceptionCaught and userEventTriggered are now in
  ChannelHandler
  
- Channel(Inbound|Outbound)HandlerContext is merged into
  ChannelHandlerContext
- ChannelHandlerContext adds direct access methods for inboud and
  outbound buffers
  - The use of ChannelBufferHolder is minimal now.
    - Before: inbound().byteBuffer()
    - After: inboundByteBuffer()
    - Simpler and better performance
    
- Bypass buffer types were removed because it just does not work at all
  with the thread model.
  - All handlers that uses a bypass buffer are broken.  Will fix soon.

- CombinedHandlerAdapter does not make sense anymore either because
  there are four handler interfaces to consider and often the two
  handlers will implement the same handler interface such as
  ChannelStateHandler.  Thinking of better ways to provide this feature
2012-06-07 14:52:33 +09:00
Trustin Lee
4831eb49da Fix a test failure in LocalChannelRegistryTest 2012-06-07 08:54:37 +09:00
Trustin Lee
843a94b989 Fix compilation errors (#384)
- ECJ worked fine with the old code, but the official compiler does not
2012-06-06 23:02:47 +09:00
norman
caa35c9772 Rethrow the Throwable which accoured while execution the modification in the EventExecutor 2012-06-05 11:34:47 +02:00
norman
4eb42125a7 Make sure we can't deadlock even if the ChannelPipeline modification is executed by the EventExecutor 2012-06-05 11:21:44 +02:00
Trustin Lee
c2e65016fd Fixed some checkstyle errors 2012-06-04 13:43:02 -07:00
Trustin Lee
1eced1e9e3 Update license headers 2012-06-04 13:31:44 -07:00
Trustin Lee
36dbbc4867 Fix a test failure 2012-06-04 12:14:42 -07:00
Trustin Lee
4630905b92 Do not wrap exceptions if possible 2012-06-04 12:10:13 -07:00
Trustin Lee
b9fc67c9b8 Get the executor of the context earlier if possible. 2012-06-04 11:59:31 -07:00
Trustin Lee
b322e98712 Remove unnecessary parameters and fields / Clean-up 2012-06-04 11:56:00 -07:00
Norman Maurer
6b637ab22f No need for a custom Runnable implementation, just use EventExecutor.submit(..).get(). Thanks @trusting for review 2012-06-04 20:49:31 +02:00
Norman Maurer
ecea558e03 Add missing synchronized 2012-06-04 20:40:17 +02:00
Norman Maurer
0e74b089c2 Merge branch 'master' of github.com:netty/netty 2012-06-04 20:34:16 +02:00
Norman Maurer
c31fbc67c2 Let DefaultChannelPipeline call lifecycle methods of ChannelHandler with respect to the new ThreadModel 2012-06-04 20:34:09 +02:00
Norman Maurer
aac5586428 Fix NPE in test 2012-06-04 20:32:12 +02:00
Trustin Lee
1a9c0fd569 Make use of the existance of bridge references to find a buffer 2012-06-04 11:18:48 -07:00
Trustin Lee
c8c577efc5 Remove an unused field 2012-06-04 09:25:39 -07:00
Trustin Lee
0aa99606d9 Fix a race where 2 handlers in different threads access the same buffer
- DefaultChannelPipeline detects such cases and creates an object called
  'bridge' that works as a man-in-the-middle to deal with a race
  condition
- Slight performance drop is observed but still faster than v3. 
  Couldn't find much from a profiler yet.
2012-06-04 00:24:34 -07:00
Trustin Lee
c1afe3d8c3 Exchanging messages between two handlers is now thread safe
- (not byte buffers yet)
2012-06-03 19:39:35 -07:00