Commit Graph

4133 Commits

Author SHA1 Message Date
Norman Maurer
8b72a4c1e2 Remove netty-metrics-yammer as it does not exist anymore 2013-01-20 07:49:42 +01:00
Norman Maurer
76d7829d38 [#960] Fix calculation of writerIndex() which was incorrect and so result in truncated DatagramPackets when using NIO 2013-01-19 17:22:28 +01:00
Norman Maurer
1295f6d331 Fix formatting 2013-01-19 16:52:12 +01:00
Norman Maurer
d8f0e3fdf7 Add missing udp option 2013-01-19 16:51:00 +01:00
Trustin Lee
b60e0b6a51 Modernize InternalLogger API and enable logging framework autodetection
- Borrow SLF4J API which is the best of the best
- InternalLoggerFactory now automatically detects the logging framework
  using static class loading. It tries SLF4J, Log4J, and then falls back
  to java.util.logging.
- Remove OsgiLogger because it is very likely that OSGi container
  already provides a bridge for existing logging frameworks
- Remove JBossLogger because the latest JBossLogger implementation seems
  to implement SLF4J binding
- Upgrade SLF4J to 1.7.2
- Remove tests for the untestable logging frameworks
- Remove TestAny
2013-01-19 20:50:52 +09:00
Norman Maurer
e8636050ca [#864] Switch to single decoding mode on the protocol upgrade to prevent races 2013-01-18 09:56:17 +01:00
Norman Maurer
f2d84f75d6 [#952] Allow to switch to single message decoding mode on the fly 2013-01-18 09:56:12 +01:00
Norman Maurer
4dd462d0b5 [#907] Stop flush if one outboundbuffer was freed and do the same for inboundBufferUpdated if an inboundbuffer was freed 2013-01-18 07:08:11 +01:00
Trustin Lee
cfa300f431 Fix APIviz panic 2013-01-18 14:12:35 +09:00
Trustin Lee
ba8c8171fa Fix leaks in buffer tests 2013-01-18 13:49:17 +09:00
Trustin Lee
b5c87b0f9c Fix failing tests 2013-01-18 13:34:00 +09:00
Trustin Lee
d0afe6cad0 Consistent exception messages 2013-01-18 13:10:54 +09:00
Trustin Lee
f670a7c923 Enable resource leak detection during test 2013-01-18 12:01:33 +09:00
Trustin Lee
24acfe7008 Remove io.netty.monitor as discussed in #922 2013-01-18 11:08:57 +09:00
Trustin Lee
2c7be32393 Tiny optimization 2013-01-18 10:49:53 +09:00
Norman Maurer
16f729cd95 [#907] Prevent IllegalBufferAccessException which could be triggered if inboundBufferUpdated() was called once the channel was closed 2013-01-17 20:41:08 +01:00
Norman Maurer
677886f470 [#907] Prevent IllegalBufferAccessException which could be triggered if inboundBufferUpdated(), flush(..), write(..) was triggered after the channel was closed 2013-01-17 15:12:32 +01:00
Norman Maurer
8a9e602a66 Prevent possible ClassCastException 2013-01-17 09:37:17 +01:00
Norman Maurer
737a350854 Fix checkstyle 2013-01-17 09:30:57 +01:00
Trustin Lee
4472fe9795 Remove 'get' prefix 2013-01-17 15:06:46 +09:00
Trustin Lee
eacc474cda Remove 'get' prefix 2013-01-17 14:48:03 +09:00
Trustin Lee
5a82dccbc5 Tighten visibility 2013-01-17 14:43:59 +09:00
Norman Maurer
dfbecb796c [#910] Make use of ByteBufHolder in SPDY, HTTP multipart and WebSockets to allow for buffer pooling 2013-01-17 06:34:52 +01:00
Trustin Lee
f568aa42f0 Hide the constructors of ChannelOption to force using dedicated option type 2013-01-17 14:14:41 +09:00
Trustin Lee
ad15155f04 Ensure cascaded derivation of a buffer does not result in an infinitely nested buffer. 2013-01-17 13:55:48 +09:00
Trustin Lee
d806e3bf81 SwappedByteBuf.unwrap() should return null
Fixes #945.  For swapped wrapped buffers, it should not return null.
2013-01-17 12:05:43 +09:00
Jeff Pinner
5b17307b1f Merge pull request #946 from jpinner/spdy_fix_compression_master
SPDY: fix improper use of SYNC_FLUSH in SpdyHeaderBlockZlibCompressor
2013-01-16 10:48:40 -08:00
Jeff Pinner
a192cfdbf0 SPDY: fix improper use of SYNC_FLUSH in SpdyHeaderBlockZlibCompressor 2013-01-16 10:42:24 -08:00
Trustin Lee
e95d3de1ff Fix a bug where HttpContents are freed too early 2013-01-17 00:50:43 +09:00
Trustin Lee
4ee11cd36f Fix bad test name 2013-01-17 00:42:51 +09:00
Trustin Lee
3b79008eda Change the WebSocket API to use HttpHeaders instead of Map<String, String> for custom headers / Cleanup 2013-01-17 00:33:40 +09:00
Trustin Lee
540bc99549 Take advantage of invocation chaining in HttpHeaders 2013-01-16 23:56:51 +09:00
Trustin Lee
34820511ff Second HTTP overhaul
- Rename message types for clarity
  - HttpMessage -> FullHttpMessage
  - HttpHeader -> HttpMessage
  - HttpRequest -> FullHttpRequest
  - HttpResponse -> FulllHttpResponse
  - HttpRequestHeader -> HttpRequest
  - HttpResponseHeader -> HttpResponse
- HttpContent now extends ByteBufHolder; no more content() method
- Make HttpHeaders abstract, make its header access methods public, and
  add DefaultHttpHeaders
- Header accessor methods in HttpMessage and LastHttpContent are
  replaced with HttpMessage.headers() and
  LastHttpContent.trailingHeaders(). Both methods return HttpHeaders.
- Remove setters wherever possible and remove 'get' prefix
- Instead of calling setContent(), a user can either specify the content
  when constructing a message or write content into the buffer.
  (e.g. m.content().writeBytes(...))
- Overall cleanup & fixes
2013-01-16 23:46:02 +09:00
Norman Maurer
f136eafd5e [#943] Fix CanceledKeyException which can happen on frequently deregister/register while using the NIO Transport 2013-01-16 15:27:27 +01: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
Norman Maurer
b7de868003 [#677] Overhaul HTTP codec
This commit tries to simplify the handling of Http easier and more consistent. This has a effect of many channges. Including:
 - HttpMessage was renamed to HttpHeader and the setContent and getContent methods were removed
 - HttpChunk was renamed to HttpContent
 - HttpChunkTrailer was renamed to LastHttpContent
 - HttpCodecUtil was merged into HttpHeaders

Now a "complete" Http message (request or response) contains of the following parts:
 - HttpHeader (HttpRequestHeader or HttpResponseHeader)
 - 0 - n HttpContent objects which contains parts of the content of the message
 - 1 LastHttpContent which marks the end of the message and contains the remaining data of the content

I also changed the sematic of HttpResponse and HttpRequest, these now represent a "complete" message which contains the HttpHeader and the HttpLastContent, and so can be used to eeasily send requests. The HttpMessageAggregator was renamed to HttpObjectAggregator and produce HttpResponse / HttpRequest message.
2013-01-15 17:51:12 +01:00
Trustin Lee
506474f569 Overhaul pipeline implementation for clarity and memory efficiency
This pull request cleans up our pipeline implementation by moving most
inter-context traversal code to DefaultChannelHandlerContext.
Previously, outbound traversal was done in DefaultChannelPipeline while
inbound traversal was done in DefaultChannelHandlerContext.

Also, to address the memory inefficiency issue raised in #920, all
runnables are lazily instantiated.
2013-01-16 00:38:14 +09:00
Trustin Lee
337f5bbb8e Automatic diagnosis of resource leaks
Now that we are going to use buffer pooling by default, it is obvious
that a user will forget to call .free() and report memory leak. In this
case, we should have a tool to determine if it is a bug in our allocator
implementation or in the user's code.

This pull request adds a system property flag called
'io.netty.resourceLeakDetection'. If set, when a user forgets to call
.free(), the ResourceLeakDetector will detect it and log a message with
detailed stack trace to tell where the leaked buffer has been allocated.

Because obtaining stack trace is an expensive operation, I used sampling
technique. Allocation is recorded only for every 113th allocation. I
chose 113 because it's a prime number.

In production, a user might not want to enable this option due to
potential performance impact. If a user does not specify the
'-Dio.netty.resourceLeakDetection' option leak detection is disabled.

Even if the leak detection is enabled, the overhead should be less than
5% because only ~1% of allocations are monitored.

I also replaced SharedResourceMisuseDetector with ResourceLeakDetector.
2013-01-15 14:15:27 +09:00
Norman Maurer
201df99ee0 Rename from io.netty.transport.* to io.netty.channel.* 2013-01-14 21:34:58 +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
Jeff Pinner
c20d875817 Merge pull request #934 from jpinner/fix_spdy_regression_master
SPDY: fix regression in SpdyFrameDecoder.decodeHeaderBlock()
2013-01-14 10:59:54 -08:00
Jeff Pinner
f75b6b142c SPDY: fix regression in SpdyFrameDecoder.decodeHeaderBlock() 2013-01-14 10:58:03 -08:00
Trustin Lee
1354b4a1ac SPDY: allow empty header values in SPDY/3
Ported from 3
2013-01-14 22:59:11 +09:00
Trustin Lee
57153079a5 Chrome requires the :version: header in SPDY_SESSION_PUSHED_SYN_STREAM frames otherwise it issues a HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS and a SPDY_STREAM_ERROR saying "HEADERS incomplete headers, but pending data frames."
Ported from 3
2013-01-14 22:37:05 +09:00
Trustin Lee
573a723dc2 Fix a bug where ChannelPIpeline.remove/replace() fails when its channel is not registered yet 2013-01-14 21:50:08 +09:00
Trustin Lee
e263769a55 Fix a bug where the buffers are freed too early when a handler is removed or replaced 2013-01-14 21:43:45 +09:00
Trustin Lee
a03bc6ea1d Fix a bug where freeInbound/OutboundBuffer() is not called when a handler is removed from a pipeline. 2013-01-14 20:54:12 +09:00
Jestan Nirojan
49bf02ce09 [#929] Implemented multi-homing opertions in SctpServerChannels and SCTP Javadocs cleanup 2013-01-13 20:52:02 +01:00
Norman Maurer
eb91a6d4e6 [#924] [#914] Fix high CPU usage which was caused because the OP_CONNECT flag was not cleared after the connect was complete 2013-01-11 19:42:21 +01:00
Trustin Lee
04bae9bceb Use sun.misc.Unsafe to access a direct ByteBuffer
- Add PooledUnsafeDirectByteBuf, a variant of PooledDirectByteBuf, which
  accesses its underlying direct ByteBuffer using sun.misc.Unsafe.
- To decouple Netty from sun.misc.*, sun.misc.Unsafe is accessed via
  PlatformDependent.
- This change solely introduces about 8+% improvement in direct memory
  access according to the tests conducted as described in #918
2013-01-11 16:25:12 +09:00