35 Commits

Author SHA1 Message Date
Johnson Yang 38c7c49a90 fix TLS1.3 connection drops if application data sent before TLS authentication completed 2026-01-08 16:44:09 -08:00
nivalxer 977fd6ac09 Fix the issue of TLS handshake failure in .NET 8 environment.
Signed-off-by: nivalxer <nivalxer@gmail.com>
2023-12-02 03:54:10 +08:00
Andrey Ilnitsky 18fbb0839e Target fix: net5 -> net5.0, net6 -> net6.0 (#592) 2022-08-04 14:53:30 -07:00
Andrey Ilnitsky f754c83069 [0.7.3] Target net5 and net6 (#588)
* [0.7.2] Start threads as background in HashedWheelTimer, LoopExecutor, ThreadDeathWatcher

* + code formatting

* [0.7.3] Target net5 and net6 (#2)

target net5 and net6
Adopted TlsHandler for the case when Handshake completion callback is dispatched asynchronously to thread pool
Introduced SingleThreadedEmbededChannel for TlsHandler and SniHandler tests

* + Update DotNetVersion to "6.0.302" in build.ps1
2022-08-02 16:37:48 -07:00
Max Gortman 05e5aa40c3 Remove XThread as obsolete 2021-07-19 16:55:44 -07:00
Andrey Ilnitsky 1cdaadbfaa - target net472 and netstandard2.0
- microsoft.extensions.logging 5.0.0
- microsoft.extensions.configuration 5.0.0
2021-07-16 18:04:31 -07:00
SilverFox 780acdb07a Port all properties io.netty.recycler.* and related logic (#497) 2019-10-21 12:49:53 -07:00
Max Gortman 6515aa0853 set version to 0.6.0 (#435) 2018-10-10 09:16:51 -07:00
SilverFox 797629ac1b Pickup some commits not related to Mono from #374 (#410)
* Add some missing method to LoggingHandler

* Avoid to alloc an huge error message when the test not failed.

* Update the unittest

* Update Microsoft.NET.Test.Sdk from 15.0.0 to 15.7.2, fix that unable to debug an unittest for the second time.
* Disable parallelization for InternalLoggerFactoryTest.TestMockReturned to avoid an rare test failure.
* Remove `dotnet-xunit` since it's never used and will be discontinued, see https://xunit.github.io/releases/2.4-beta2

* Remove space from filename

* Switch back to `DiscardSomeReadBytes` since it's avaliable

* Rework some logic in TlsHandler

* Make sure TlsHandler.MediationStream works well with different style of aync calls(Still not work for Mono, see #374)
* Rework some logic in #366, now always close TlsHandler.MediationStream in TlsHandler.HandleFailure since it's never exported.

* Workaround to fix issue 'Microsoft/vstest#1129'.

* Change the default of TcpServerSocketChannel.Metadata.defaultMaxMessagesPerRead to 1
2018-08-13 11:38:06 -07:00
Johnny Z f227f95966 HTTP 1.1 codec #52 (#256) 2018-04-11 09:31:39 -07:00
Johnny Z 33b95cfe61 Buffer read/write/get/set strings. (#369)
Motivation:
Implement commonly used string-based operations (originally Netty CharSequence) for byte buffers.

Modifications:
Added read/write/get/set strings methods to byte buffers.
Also reduced unsafe pin/unpins for byte operations.

Result:
String-based operations are supported in DotNetty
2018-03-15 14:58:49 -07:00
SilverFox b2e8b4ba15 Improve unittest and fix some leak (#366)
- Fix #353, SniHandlerTest timeout in net452 and netcoreapp2.1(preview).
- Fix that test for TlsHandlerTest.NoAutoReadHandshakeProgresses never finish in netcoreapp2.0 and 2.1(preview)
- Fix some leak on TlsHandler and EmbeddedChannel.
- Update xunit from 2.2.0 to 2.3.1. That greatly improve the test speed of DotNetty.Buffers.Tests in net452.
2018-03-07 07:28:40 -08:00
Johnny Z 6b86b1b883 Re align with Netty buffers. (#287) 2017-09-15 11:32:11 -07:00
Max Gortman 5865d225df Fixes #225
extra: flaky test fixes
2017-05-15 11:22:41 -07:00
Max Gortman 95f79e1cd2 Porting HashedWheelTimer (#242)
Motivation:
It is a common task to manage various timeouts in networking code. Normal high precision timers usually trade performance for precision which is a flexible requirement with timeouts.

Modifications:
- added HashedWheelTimer
- moved RejectedExecutionException to Common.Concurrency

Result:
- users may choose to use HWT in their code to avoid contentions due to frequent timer management.
2017-05-12 02:35:28 -07:00
Johnny Z c79a974400 Changed unit test projects to NET452 required by xunit 2.2.0 (#229) 2017-04-05 10:16:33 -07:00
Johnny Z 107a1c87b1 Follow up .NET tooling to upgraded packages to latest stable version
1. Microsoft.Extensions.Configuration from 1.1.0 to 1.1.1
2. Microsoft.Extensions.Logging from 1.1.0 to 1.1.1
3. Google.Protobuf from 3.1.0 to 3.2.0
4. Microsoft.NET.Test.Sdk from 15.0.0 preview to 15.0.0
5. XUnit to 2.2.0 release
6. Moq from alpha to 4.7.1
7. NBench from 0.3.4 to 1.0.0
2017-03-21 15:03:36 -07:00
Alex Valuyskiy 00d656c533 Downgraded to net45 (#197) 2017-02-22 12:23:29 -08:00
Max Gortman 52d1bf34d1 Migrating to new .Net Core RC tooling (#192) 2017-02-09 02:30:48 -08:00
Max Gortman 4f28a55b48 Move to .NET Core tooling (#170)
Motivation
.NET Core tooling allows building for both .NET Framework and .NET Standard while easing pains of running tests and packaging.

Modifications
- csproj -> xproj + project.json
- support for .NET Standard 1.3
- build script is now based on CAKE
- using dotnet CLI for building, testing, packing
- strong name by default (snk included)

Result
DotNetty works on .NET Core and any other platform supporting .NET Standard 1.3+.
2016-11-07 17:50:24 -08: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 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 47163fde8d switching to C# 6.0 2016-05-05 01:19:49 -07:00
Aaron Stannard 31864c6db0 added NBench support + End2End performance spec for TCP 2016-05-01 10:06:10 -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
Mikhail 30806f5eac Poll task from the queue. Hotfix 2016-04-14 18:14:43 -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
mgortman 72888b9a64 Porting resource leak detection
Motivation:
Leak of IReferenceCounted resources is a very common issue while
developing with DotNetty (both codecs and higher level applications).
Having leak detection helps identifying and resolving this kind of issues.

Modifications:
- Added ResourceLeakDetector
- Added leak-aware Byte Buffer implementations

extras
- port of missing Byte Buffer methods
- fixing minor issues with previous PRs

Result:
Simple leak detection is enabled by default on PooledByteBufferAllocator,
leaks are reported through internal logger, advanced leak detection is
available via LeakResourceDetector
2015-11-12 17:12:35 -08:00
mgortman 8b59715deb Improved perf of SingleThreadEventExecutor
Motivation:
Impove performance of execution model

Modifications:
- switched SemaphoreSlim for ManualResetEventSlim to track empty vs non-empty states for executor's queue

extras
- removing wait for event loop shutdown (reduces test run time)
- adding benchmarking
- extracted common test utilities into Tests.Common project
- fixing ReSharper settings for ReSharper 10

Results:
5x improvement on in-loop scheduling, 2x improvement on out-of-liio scheduling:
STEE in loop (new)
        624ms   1,406,159Kc (G0= 114, G1=   0, G2=   0)
STEE in loop (old)
      2,719ms   6,205,423Kc (G0= 114, G1=   0, G2=   0)
STEE out of loop (new)
      1,464ms   6,559,838Kc (G0=  95, G1=   0, G2=   0)
STEE out of loop (old)
      3,869ms  12,331,986Kc (G0=  38, G1=  28, G2=   3)
2015-11-09 04:30:42 -08:00
mgortman 0722ade2a8 Motivation:
enable netty's internal logging experience to ease porting efforts and streamline logging configuration

Modifications:
- ported over InternalLogger and InternalLoggerFactory
- implemented InternalLogger using EventSource
- switched existing internal logging to this (increasing parity with netty)
- added logging configuration in Echo example
- added log to xunit output to end-to-end tests

*** extras
- fixed Echo client to send back received message (not 0 bytes)
- MqttDecoder no longer closes the Channel by itself instead changing internal state to invalid and forwarding an exception.
- further fix to ReSharper's code cleanup settings to properly arrange scope modifiers

Result:
internal components can use familiar experience to perform logging, e.g. `static readonly IInternalLogger Logger = InternalLoggerFactory.GetInstance<AbstractChannel>();`
2015-10-26 02:42:55 -07:00
Aaron Stannard 9cf6903b2a Created FAKE script for DotNetty
added a reference to .\src\SharedAssemblyInfo.cs in all release-able projects
added DotNetty nuspec files for each package
fixed XUnit test script
2015-08-12 22:08:54 -07:00
mgortman b9336e0817 first commit 2015-07-16 01:41:06 -07:00