Commit Graph

367 Commits

Author SHA1 Message Date
Norman Maurer
79541bceb6 Replace usage of System.currentTimeMillis() with System.nanoTime()
Motivation:

Currently we use System.currentTimeMillis() in our timeout handlers this is bad
for various reasons like when the clock adjusts etc.

Modifications:

Replace System.currentTimeMillis() with System.nanoTime()

Result:

More robust timeout handling
2014-03-18 16:07:35 +09:00
Trustin Lee
614dc72b56 Do not use finally to propagate events in AbstractRemoteAddressFilter
Motivation:

We don't really need to propagate an event when handling the event fails.

Modifications:

Do not use finally block in AbstractRemoteAddressFilter

Result:

AbstractRemoteaddressFilter does not forward an event in case of failure.
2014-03-12 16:18:10 +09:00
Trustin Lee
fddbde7df2 Overall clean-up of ipfilter package
Motivation:

Recently merged ipfilter package has the following problems:
* AbstractIpFilterHandler could be improved to support any SocketAddress types rather than only InetSocketAddress.
* AbstractIpFilterHandler can be removed immediately after decision is made rather than keeping the outcome of the decision as an attribute.
* AbstractIpFilterHandler doesn't have a hook for the accepted addresses.
* The hook method (reject()) needs to be named in line with other handler methods (i.e. channelRejected())
* IpFilterRuleHandler should allow accepting zero rules - it's particularly useful for machine-configured setup (i.e. specifying zero rules disables ipfilter).
* IpFilterRuleType.ALLOW/DENY should be ACCEPT/REJECT for consistency.

Modifications:

* AbstractIpFilterHandler has been renamed to AbstractRemoteAddressFilter and now uses type parameter.
* Added channelAccepted() and renamed reject() to channelRejected()
* Added ChannelHandlerContext as a parameter of accept() so that accept() can add a listener to the closeFuture() of the channel. This way, UniqueIpFilter continue working even if we remove the filtering handler early.
* Various renames
  * IpFilterRuleHandler -> RuleBasedIpFilter
  * UniqueIpFilterHandler -> UniqueIpFilter

Result:

* Much cleaner API with more extensibility
2014-03-12 16:09:37 +09:00
Jakob Buchgraber
e6cf85d78d ipfilter implementation for netty 4/5 [#2129] 2014-03-10 20:41:35 +01:00
Norman Maurer
5bdfbbc7d1 [#2261] Correct javadoc of ChunkedInput 2014-03-03 07:04:19 +01:00
Trustin Lee
3f2d3c9f1d Avoid unnecessary IllegalStateException in ChunkedWriteHandler
Motivation:
ChunkedWriteHandler can sometimes fail to write the last chunk of a ChunkedInput due to an I/O error.  Subsequently, the ChunkedInput's associated promise is marked as failure and the connection is closed.  When the connection is closed, ChunkedWriteHandler attempts to clean up its message queue and to mark their promises as success or failure.  However, because the promise of the ChunkedInput, which was consumed completely yet failed to be written, is already marked as failure, the attempt to mark it as success fails, leading a WARN level log.

Modification:
Use trySuccess() instead of setSuccess() so that the attempt to mark a ChunkedInput as success does not raise an exception even if the promise is already done.

Result:
Fixes #2249
2014-02-20 17:15:02 -08:00
Trustin Lee
072b6eaa0f Fix a compilation error 2014-02-13 19:59:20 -08:00
Trustin Lee
ce9403cc3a Do not use String.format() for log message generation
- It's slow.
2014-02-13 19:31:45 -08:00
Trustin Lee
4a86446053 Fix the potential copyright issue in SocksCommonUtils
- Add StringUtil.toHexString() methods which are based on LoggingHandler's lookup table implementation, and use it wherever possible
2014-02-06 15:01:55 -08:00
Norman Maurer
b3e4122499 [#2159] Not fail the ChannelPromise with WriteTimeoutException to prevent warning 2014-01-29 13:56:42 +01:00
Trustin Lee
f05a20029b Remove the deprecated constructors in SslHandler 2014-01-09 18:13:44 +09:00
Trustin Lee
53110a83b3 Fix a regression in SslHandler where delegated tasks run in a different executor makes the session hang
- Fixes #2098
- Deprecate specifying an alternative Executor for delegated tasks for SslHandler
2014-01-09 18:08:48 +09:00
Trustin Lee
f3a842ecca [maven-release-plugin] prepare for next development iteration 2013-12-22 22:06:15 +09:00
Trustin Lee
888dfba76f [maven-release-plugin] prepare release netty-5.0.0.Alpha1 2013-12-22 22:06:06 +09:00
Trustin Lee
94d6e44bba Change the return type of EmbeddedChannel.read*() from Object to an ad-hoc type parameter
.. so that there's no need to explicitly down-cast.

Fixes #2067
2013-12-16 22:22:47 +09:00
Trustin Lee
02a79c51e5 Fix a bug in SslHandler where a ClassCastException is raised when non-ByteBuf message is passed
- Fixes #1828
2013-12-16 16:30:24 +09:00
Trustin Lee
082ecd9140 Fixed buffer leaks in LoggingHandlerTest 2013-12-07 11:59:53 +09:00
Norman Maurer
643ce2f8c0 Fix all leaks reported during tests
- One notable leak is from WebSocketFrameAggregator
- All other leaks are from tests
2013-12-07 00:47:30 +09:00
Norman Maurer
6bba3c19dd [#2033] Correctly handle adding of IdleStateHandler after Channel was already active and registered 2013-12-03 14:47:18 +01:00
Trustin Lee
f1ea6fb98f Improve documentation for the two-args formatter in LoggingHandler 2013-12-02 18:58:56 +09:00
Trustin Lee
99c01aa9f3 Rename formatUserMessage to formatSimple and use it in two-args formatter in LoggingHandler 2013-12-02 18:57:38 +09:00
Trustin Lee
0dddec8dfd Simplify two-args message formatter in LoggingHandler 2013-12-02 18:56:33 +09:00
Trustin Lee
4fcec8b87d Make LoggingHandler.appendHexDump(..) protected for the subclasses 2013-12-02 18:48:19 +09:00
Trustin Lee
5e575daefc Optimize and clean up LoggingHandler
- Use ': ' instead of '(...)' for simpler string concatenation and prettier presentation
- Optimize the overall performance of format*() methods
- All format*() methods are now expected to encode the channel information by themselves so that StringBuilder instances are created less often.
- Use a look-up table for generating per-row prefixes
- Hid formatByteBuf(), formatByteBufHolder(), and formatNonByteBuf() from user because a user can always override format(ctx, eventName, arg).  For example, to disable hexdump:

    protected void format(ChannelHandlerContext ctx, String eventName, Object arg) {
        if (arg instanceof ByteBuf) {
            super.format(ctx, eventName, arg.toString());
        } else {
            super.format(ctx, eventName, arg);
        }
    }
2013-12-02 18:44:30 +09:00
Trustin Lee
110745b0eb Remove the distinction of inbound handlers and outbound handlers
- Fixes #1808
- Move all methods in ChannelInboundHandler and ChannelOutboundHandler up to ChannelHandler
- Remove ChannelInboundHandler and ChannelOutboundHandler
- Deprecate ChannelInboundHandlerAdapter, ChannelOutboundHandlerAdapter, and ChannelDuplexHandler
- Replace CombinedChannelDuplexHandler with ChannelHandlerAppender
  because it's not possible to combine two handlers into one easily now
- Introduce 'Skip' annotation to pass events through efficiently
- Remove all references to the deprecated types and update Javadoc
2013-11-27 17:31:28 +09:00
Trustin Lee
807d96ed6c Simplify bundle generation / Add io.netty.versions.properties to all JARs
- Fixes #2003 properly
- Instead of using 'bundle' packaging, use 'jar' packaging.  This is
  more robust because some strict build tools fail to retrieve the
  artifacts from a Maven repository unless their packaging is not 'jar'.
- All artifacts now contain META-INF/io.netty.version.properties, which
  provides the detailed information about the build and repository.
- Removed OSGi testsuite temporarily because it gives false errors
  during split package test and examination.
- Add io.netty.util.Version for easy retrieval of version information
2013-11-26 22:00:14 +09:00
Alex Petrov
883ab29d05 Improve doc of IdleStateHandler according to example given in UptimeClientHandler (L57) 2013-11-20 10:24:09 +01:00
Trustin Lee
6e2593ddc3 Fix regression introduced by 4c7fa950cc
- Some promises were not fulfilled when SSLEngine produces 0 bytes.
2013-11-14 15:08:10 +09:00
Trustin Lee
4c7fa950cc Optimize SslHandler
- Fixes #1905
- Call ctx.flush() only when necessary
- Improve the estimation of application and packet buffer sizes
- decode() method now tries to call unwrap() with as many SSL records as
  possible to reduce the number of events triggered
2013-11-08 17:42:28 +09:00
Michael Nitschinger
ea7b690430 add docs and testing for the LoggingHandler. 2013-11-06 18:19:19 +01:00
Trustin Lee
6b0025430e Bump the version to 5.0.0.Alpha1 2013-11-04 19:14:40 +09:00
Trustin Lee
2eb5d4f0dd Fix a bug where SslHandler doesn't sometimes handle renegotiation correctly
- Fixes #1964
2013-11-04 16:53:05 +09:00
Trustin Lee
0dda7df344 Add a shortcut method for collision-free naming 2013-10-25 20:01:31 +09:00
Trustin Lee
dc009b2c2c Replace UniqueName with Constant and ConstantPool
- Proposed fix for #1824

UniqueName and its subtypes do not allow getting the previously registered instance.  For example, let's assume that a user is running his/her application in an OSGi container with Netty bundles and his server bundle.  Whenever the server bundle is reloaded, the server will try to create a new AttributeKey instance with the same name.  However, Netty bundles were not reloaded at all, so AttributeKey will complain that the name is taken already (by the previously loaded bundle.)

To fix this problem:

- Replaced UniqueName with Constant, AbstractConstant, and ConstantPool.  Better name and better design.

- Sctp/Udt/RxtxChannelOption is not a ChannelOption anymore.  They are just constant providers and ChannelOption is final now.  It's because caching anything that's from outside of netty-transport will lead to ClassCastException on reload, because ChannelOption's constant pool will keep all option objects for reuse.

- Signal implements Constant because we can't ensure its uniqueness anymore by relying on the exception raised by UniqueName's constructor.
2013-10-25 19:21:53 +09:00
Norman Maurer
9e82bfbf3c [#1936] Fix example in javadoc 2013-10-20 09:32:21 +02:00
Norman Maurer
3a01bf1064 [#1934] Correctly log handshake errors and not print them to STDERR 2013-10-18 18:23:24 +02:00
Norman Maurer
23998048b1 [#1898] No call fireExceptionCaught but just fail the write promise 2013-10-08 06:39:21 +02:00
Norman Maurer
cd2eaebd92 [#1895] Fix IllegalStateException which was produced during failing ChunkedWrite after the channel was closed 2013-10-08 06:36:59 +02:00
Norman Maurer
52660dfcfa Propagate channelWritabilityChanged() through the pipeline after flushing. Related to [#1861] 2013-09-24 14:19:53 +02:00
Norman Maurer
f35ba4f80f Correctly handle automatically suspend/resume in ChunkedWriteHandler. Related to [#1861]
The old implementation was broken and could lead to pending message never be picked up again until the user either explicit called flush or
resumeTransfer().
2013-09-24 14:19:38 +02:00
Norman Maurer
5aa2b7e9f7 [#1855] Try to calculate the correct amount of written bytes to update the ChannelProgressiveFuture 2013-09-24 07:50:02 +02:00
Trustin Lee
95576d6559 Ensure operationProgressed is invoked even on completion
- Fixes #1809
2013-09-05 18:36:48 +09:00
bgallagher
c149f4bcc0 Remove support from deregister a Channel from a EventLoop manually 2013-08-29 18:11:16 +02:00
Norman Maurer
09a748abdb Bump up version to 4.1.0.Alpha1-SNAPSHOT 2013-08-26 15:18:18 +02:00
Norman Maurer
2e39b25cd4 [maven-release-plugin] prepare for next development iteration 2013-08-26 12:01:03 +02:00
Norman Maurer
b67659a866 [maven-release-plugin] prepare release netty-4.0.8.Final 2013-08-26 12:00:54 +02:00
Norman Maurer
9e7529b2f5 [#1743] Fix IllegalStateException by remove usage of PendingWrite in ChunkedWriteHandler. This needs more thoughts before re-introduce it 2013-08-16 08:11:19 +02:00
Norman Maurer
48eb73f9b1 [#1733] Correctly pass the promise to the ctx.write(...) in AbstractTrafficShapingHandler 2013-08-13 08:21:26 +02:00
Norman Maurer
f8f19d1539 [#1732] Fix bug which lead ChannelTrafficShapingHandler stop to work after first Channel was disconnected 2013-08-13 08:09:59 +02:00
Norman Maurer
8af5ea8d4f [#1658] Allow to use AbstractTrafficShapingHandler also with ByteBufHolder based messages 2013-08-10 20:25:35 +02:00