73 Commits
Author SHA1 Message Date
Max Gortman 97d90cf026 set version to 0.3.2 2016-06-22 14:48:45 -07:00
Mikhail Tuhckov 8a42c72964 Negotiage client certificate (#134)
Motivation:
SslStream's paramter required client certificate is misleading. In fact in suggests to client to provide the certificate and client may or may not provide it.
If client has not provided the client certificate - it assumes that client is not authenticated from TLS prospective and continues the handshake

Modification:
Expose this setting as a parameter, so that users could set it if needed.

Results:
Allows users to do a client certificate authentication on server.
2016-06-18 11:57:17 -07:00
Mikhail Tuhckov fb18eaffd7 Exposes SSL Stream and adds more TLS settings (#132)
Motivation:

Some important SSL Stream settings are hidden in the TlsHandler class

Modifications:
SSLStream is provided by user now via factory method;
TLS settings extended

Results:
More advanced scenarios, like X509 client authentication, are possible to do now
2016-06-16 12:07:04 -07:00
Max Gortman 8ab8c8bf0c porting removal of invoker, better decoupling (#125)
Motivation:
Catching up on recent netty changes, simplifying data flow through channel pipeline

Modifications:
- Replaced IChannelHandlerInvoker with direct methods on IChannelHandlerContext implementation.
- Ported changes in AbstractChannel, DefaultChannelPipeline, etc. to reduce coupling through casting.

Result:
IChannelHandlerInvoker is removed, perf improved, it is easier to implement IChannel or IChannelPipeline from scratch.
2016-06-13 12:32:06 -07:00
Max Gortman dabc1d34c3 set version to 0.3.1 2016-06-01 19:08:05 -07:00
Max Gortman ff93b80592 Check MQTT packet identifier > 0. Fixes #76 2016-06-01 15:03:19 -07:00
Max Gortman 477aac9a0c Adds xml-doc output/packaging - fixes (#103)
Motivation:
Improve dev exp using DotNetty nuget packages.

Modifications:
- enabled xml-doc output on projects

Result:
xml-docs are packages along binaries in nuget packages.
2016-06-01 14:30:14 -07:00
Max Gortman f31c02e346 Fixes TlsHandler from operation, perf and compat POVs.
Motivation:
TlsHandler
Fix TlsHandler, optimize encryption / decryption wrt Write vs Flush semantics, optimize memory retention for sparse communication, adopt IByteBuffer.GetIoBuffers() in TlsHandler.

Modifications:
- TlsHandler is rewritten to use batch->copy->write approach instead of writing directly to SslStream in order to reduce overhead of framing / writing out everything separately.
- TlsHandler uses IByteBuffer.GetIoBuffers intead of direct array access increasing compatibility for non-array-backed buffers.
- TlsHandler and TlsHandler.MediationStream use Task semantics now when reading through SslStream.
- Extra: upgraded to NBench 2.2, xUnit 2.1.0.
- Extra: better portability for .NET Core support.

Result:
TlsHandler provides better framing and much better (x2+) performance (depends on application control of flushing).
TlsHandler operates properly in edge cases when more than one frame is accepted at once and if decrypted frame size is more than 4 KB.
TlsHandler holds only 256 byte buffer while waiting for more data to arrive off the wire.
Extra: DotNetty is almost .NET Core compatible.
2016-06-01 14:09:14 -07:00
Max Gortman 0131fa9fe2 Porting adaptive read buffer prediction
Motivation:
Provides good flexible default while lowering memory consumption on average.

Modifications:
- Synced IRecvByteBufAllocator and relevant parts up to date
- Ported AdaptiveRecvByteBufAllocator
- Extra: properly porting ChannelMetadata

Result:
Process of receiving bytes from network is more configurable and allows for both more conservative and more agressive ingestion.
2016-05-31 17:55:07 -07:00
Max Gortman 29315699f1 Merge pull request #114 from nayato/attrs
Adds attribute support in Channel, Bootstrap [#78]
2016-05-17 17:50:41 -07:00
Max Gortman 6cf5cf5499 Adds attribute support in Channel, Bootstrap [#78]
Motivation:
Increasing feature parity and dev convenience through addition of arbitrary data assignment on Channel and related API on Bootstrap classes.

Modifications
- Introduced IAttributeMap, IAttribute<T>, IConstant and related impl artifacts.
- Moved ChannelOption to common constant codebase
- AbstractChannel now inherits from DefaultChannelMap
- Reflection-less child optoins config in ServerBootstrap
- Extra: minor closure allocation fixes, internal API fixes.

Result:
Attributes can be set on Channels, better code portability in Bootstrap.
2016-05-17 17:44:00 -07:00
Glebov Boris c9418595e7 Implementation Idle connections and timeouts.
Modifications:

Added new handlers:

- IdleStateHandler.cs
- ReadTimeoutHandler
- WriteTimeoutHandler
- ChannelDuplexHandler

Added a new utils class for work with time:

- TimeUtil.cs
2016-05-15 13:00:03 +05:00
Max Gortman 7f3f9e5cea set version to 0.3.0, fixing build 2016-05-13 18:17:50 -07:00
Max Gortman ebc82c4e2d Moving towards .NET Platform compatibility
Motivation:
Support new versions of .NET, have a core framework that is portable across all .NET platforms.

Modifications:
addressing part of issues reported by portability analyzer

Result:
Easier to introduce .NET Platform compatibility in the future.
2016-05-13 14:16:26 -07:00
Max Gortman 8114b7fb21 Fixing minor issues and code style throughout
Motivation:
Modern language features provide for easier to read, more compact code.

Modifications:
- expression body for single line methods
- Extra: fixes in xml docs
- Extra: code style deviations in recent commits

Result:
Cleaner, more consistent code.
2016-05-13 12:18:04 -07:00
Max Gortman 1a80817c71 Enables multi-buffer send in TcpSocketChannel. Remove constraints on IByteBuffer for writing.
Motivation:
In order to avoid buffer copies and yet perform IO efficiently,
it is essential to support sending multiple byte sequences in one call.
Also there should be no additional constraints on IByteBuffer implementations
in order to be accepted by TcpSocketChannel for sending.

Modifications:
- IoBufferCount, GetIoBuffer(), GetIoBuffers() are ported to IByteBuffer and implementations.
- ChannelOutboundBuffer is extended to leverage *IoBuffer* members in order to prepare buffer batches for sending.
- TcpSocketChannel and its ancestors were extended to support sending (sync and async) a list of array segments.
- Extra: fixes WriterIndex positioning in ByteBufferUtil.EncodeString(..).
- Extra: TLS support and exception reporting in benchmark (commented out).
- Extra: fixes async send path in TcpSocketChannel and AbstractSocketChannel.

Result:
A benchmark of single client channel writing to a single server channel runs 3 times faster at 150K op/sec (vs 53K op/sec before) with no increase in CPU consumption.
CompositeByteBuffer can be used directly in IChannel.WriteAsync.
2016-05-12 18:42:54 -07:00
Max Gortman 28f6279761 Adds Schedule support for IRunnable actions.
Motivation:
Improving support for future porting efforts relying on special implementations of IRunnable tasks.

Modifications:
- Added IEventExecutor.Schedule(IRunnable, TimeSpan) overload
- Extra: cleaning out IEventExecutor.Unwrap and related IWrappedEventExecutor.
- Extra: fixing synchronization in DefaultChannelPipeline's Replace and DestroyDown methods.

Result:
Better support for IRunnable implementations in execution model.
2016-05-09 14:29:13 -07:00
Max Gortman c23becfea1 Merge pull request #106 from nayato/pipeline
Syncing core channel pipeline elements up to date.
2016-05-09 10:37:29 -07:00
Max Gortman ab72d4af7b Syncing core channel pipeline elements up to date.
Motivation:
initial port was based on now dropped netty 5.0. This is an effort to bring core channel model artifacts to terms  with ongoing development in netty 4.1. As a result future sync efforts should be much lower.

Modifications:
- Rewrote DefaultChannelPipeline (port as much as possible)
- Updated AbstractChannelHandlerContext (Skip handling is preserved from netty 5.0)
- Revisited AbstractChannel
- Extra: fixes in benchmark
- Extra: tweaking spin count on STEE

Result:
Core channel model elements are up to speed on recent modifications in netty.
2016-05-09 02:43:03 -07:00
jeoffman 7bbfe1bddf porting in DelimiterBasedFrameDecoder from Java (redo) 2016-05-06 06:29:08 -05:00
mgortman cef1295c3c PooledByteBufferAllocator port, Byte Buffers improvements
Motivation:
Existing rudimentary buffer pool implementation is not flexible to efficiently support scenarios with high variety in message sizes.

Modifications:
- implemented PooledByteBufferAllocator (port of PooledByteBufAllocator) and related artifacts
- made IByteBuffer implement IEquatable<IByteBuffer>, IComparable<IByteBuffer>, implemented Equals, GetHashCode.
- ported test suite for Byte Buffers and fixed discovered issues.
- added suppression of ExecutionContext flow on async read / write on socket-based channels.
- removed old pooled Byte Buffer allocator implementation.

Result:
Support for buffer pooling for larger byte sequences, more efficient usage of memory dedicated for the pool.
2016-05-05 17:40:07 -07:00
Max Gortman 47163fde8d switching to C# 6.0 2016-05-05 01:19:49 -07:00
Max Gortman 3fb1984e9c Merge pull request #94 from robichaud/jsonobjectdecoder-93
Implemented JsonObjectDecoder
2016-04-28 01:35:49 -07:00
robichaud 17d7429d5d Ported JsonObjectDecoder
Motivation:
Needed a json decoder

Modifications:
- added JsonObjectDecoder

Result:
- implemented JsonObjectDecoder
2016-04-27 20:30:40 -05:00
Max Gortman 4d8b02eca7 refreshed build, set version to 0.2.6 2016-04-27 17:45:52 -07:00
Max Gortman aa3cbc6766 Fixes ByteBuffer+Stream integration, TLS neg, STEE Shutdown
Motivation:
Fix up top priority issues to ensure proper working state with recent changes.

Modifications:
- TlsHandler negotiates TLS 1.0+ on server side (#89)
- STEE properly supports graceful shutdown (#7)
- UnpooledHeapByteBuffer.GetBytes honors received index and length (#88)
- Echo E2E test uses length-prefix based framing (#90)

Result:
Setting up DotNetty does not require workarounds for shutdown and hacks to enable negotiation of higher versions of TLS. Tests are passing even with new SslStream behavior.
2016-04-27 10:51:02 -07:00
Glebov Boris a8b40617fd Implementation the StringEncoder and StringDecoder and all them dependencies
Modifications

 - Added LineBasedFrameDecoder.cs
 - Added MessageToMessageDecoder.cs
 - Added StringDecoder.cs, StringEncoder.cs
 - Added ByteProcessor.cs
 - Added methods ForEachByte in IByteBuffer (also implemented them in AbstractByteBuffer.cs, EmptyByteBuffer.cs, SwappedByteBuffer, WrappedByteBuf);
 - Added method EncodeString in ByteBufferUtil.cs
2016-04-27 15:03:20 +05:00
Aaron Stannard e0180e36c8 fixed nuget 3.x packaging issues 2016-04-26 21:38:01 -07:00
Max Gortman 45e7a081b2 set version to 0.2.5 2016-04-15 01:43:22 -07:00
Mikhail 30806f5eac Poll task from the queue. Hotfix 2016-04-14 18:14:43 -07:00
Max Gortman e9d3fce6ef Merge pull request #82 from nayato/build-signed
Better signed build automation
2016-04-10 01:10:03 -07:00
mgortman 3cfcafd75e set version to 0.2.4 2016-04-08 02:54:48 -07:00
mgortman 13863df29d Better signed build automation
Motivation
Since signed assemblies became part of the release they slowed down release cycle due to extended effort necessary to prepare nuget packages with signed assemblies.

Modifications
- introduced "Signed" solution configuration
- optional Test Friends (turned off in Signed)
- re-signing support in build script

Result
New releases can be produced quicker with less effort.
2016-04-08 02:52:18 -07:00
mgortman ba716c6778 STEE: smarter idle waiting for scheduled tasks
Motivation:
use of breakoutInterval setting on SingleThreadEventExecutor while executor is idling is confusing to users and inefficient due to fixed interval wake ups. We can do better by peeking next scheduled task and use its deadline for wait timeout.
While breakoutInterval is still useful while executor is busy, it can be reduced now to much lower number without impacting idle performance.

Modifications:
- When going to wait due to empty immediate queue, consult with scheduled task queue to figure out timeout value (next task's deadline - now).
- default breakoutInterval changed to 100 ms for higher resolution for scheduled tasks while busy.

Result:
Better precision for scheduled tasks at no performance cost while idling.
2016-04-06 13:35:26 -07:00
mgortman d5a4c30778 Adds IEventExecutor.Schedule, proper cancellation of scheduled tasks
Motivation:
Allow for less GC when scheduling if Task-based API is not required. Allow for proper cleanup when canceling scheduled task so that associated resources can be cleaned up early.

Modifications:
- Moved out scheduled task implementations from AbstractScheduledEventExecutor
- Introduced IScheduledTask and aligned IScheduledRunnable
- Implemented removal of scheduled task upon its cancellation
- Extra minor fixes
 - IByteBuffer.ToString(Encoding) honoring ArrayOffset
 - InternalLoggerFactory creating default logging factory lazily

Result:
Scheduled tasks that normally never fire (e.g. timeout handling) do not cause resources to be held up unnecessarily in memory for longer period of time if not necessary.
2016-04-05 19:17:46 -07:00
VIEWPOINT 5b1139ee07 Improved pooling of buffers when a buffer was released in other thread.
Motivation:

When buffer was released in other thread, this buffer couldn't be released. I think that need to release a buffer in other thread for memory effectiveness.

Modifications:

Implement WeakOrderQueue for releasing a buffer that other thread owned.

Result:

When buffer was released in othread thread, owned thread can use this buffer.
2016-02-22 07:51:31 +09:00
Max Gortman 0a9b9641c7 Merge pull request #72 from nayato/buffers
Fixes pooled buffer's AdjustCapacity to properly set the length
2016-02-17 16:12:56 -08:00
mgortman 1f77e0cc64 Fixes pooled buffer's AdjustCapacity to properly set the length
Motivation:
Fix a bug #71.

Modifications:
Set length property of a PooledByteBuffer in case of a switch of underlying array to unpooled.

Results:
PooledByteBufferAllocator can work with buffers bigger than pooled buffer's original capacity.
2016-02-17 00:08:15 -08:00
mgortman e19221e977 set version to 0.2.3 2016-02-10 03:43:18 -08:00
mgortman 89189427a8 Enables setting options specific to DefaultSocketChannelConfiguration (fix #68)
Motivation:
Fix a bug that breaks setting options specific to socket-based channel implementations

Modifications:
Added SetOption overload accepting socket-specific options to DefaultSocketChannelConfiguration

Result:
It is possible to modify send/receive buffer size and other settings through SetOption on Bootstrap.
2016-02-10 02:04:33 -08:00
mgortman 5c703462a1 Fixes premature completion of async operations (#66)
Motivation:
Due to misuse of IEventExecutor.SubmitAsync in
DefaultChannelHandlerInvoker and Bootstrap, async operations return future
that is completed after first sync part of operation is through.

Modifications:
DefaultChannelHandlerInvoker and Bootstrap are modified to complete
returned future only after the whole async operation is completed.

Result:
chaining async operations does not result in intermittent failures due to
premature access to channel, errors potentially appearing in later stages
of async operations are also properly reported through failure of the
future.
2016-02-09 18:40:36 -08:00
Max Gortman c48e8e2364 Merge pull request #65 from nayato/rld-rearm
Fixes #64
2016-01-30 01:42:19 -08:00
mgortman 763e4650a6 Fixes #64
Motivation:
ResourceLeakDetector throws when the same object is picked through sampling

Modification:
GCNotice is made reusable to avoid the described issue

Result:
ResourceLeakDetector can be used without unexpected errors from repeated use
2016-01-29 18:30:46 -08:00
hide1202 d7cbe06feb Implemented ToString methods in ByteBuffers.
Motivation:

If users want to change the ByteBuffer of the string, it is complicated.

Modifications:

Implement ToString methods in IByteBuffer and derived classes.

Result:

Users can easily use to change IByteBuffer to the string.
2016-01-25 08:40:04 +09:00
Mikhail 6d5ec32da1 Assing GUID to event source
Motivation:

Guid is necessary for other systems to make a distinction between event.

Modifications:

Guid assigned to the DefaultEventSource.

Result:
We have a Guid now. Yay!
2015-12-09 21:38:52 -08:00
mgortman f08e35d808 version 0.2.1 2015-12-08 14:38:27 -08:00
Max Gortman 6e5e26ebcb Merge pull request #56 from nayato/fixes
Fix #55
2015-12-04 16:13:58 -08:00
Sudheer 08c6d22a5f Port LoggingHandler Fixes #38
Port Logging Handler Fixes #38

Motivation:

LoggingHandler  is a must in many situations especially with non-trivial
pipeline composition so it will definitely be ported soon . It actually
provides nice looking bytebuf output + additional log for all the
events.

Modifications:
Added Logging functionality to DotNetty.Handlers project
Modified Echo.Server example project to log the events

Result: Easier to learn DotNetty from output by LoggingHandler
2015-11-30 16:01:00 +05:30
mgortman 7ccec95234 Fix #55
Motivation:
revisit EmptyByteBuffer port to ensure complete functionality

Modifications:
- ported trivial implementation of ToArray, Duplicate and other methods
- minor cleanup

Result:
EmptyByteBuffer does not throw exceptions when operation can be completed in a trivial way (0 byte length is enough to complete the operation).
2015-11-25 03:53:31 -08:00
Aaron Stannard a5d38b2f96 Fixed a bug with SwappedByteBuffer that would cause VS Debugger to crash 2015-11-20 13:52:58 -08:00