21 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
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
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
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
alextolp 65b47356dd Make ReadListeningHandler thread-safe 2017-10-26 18:25:46 -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
Krishnendu Ghosh 1d3eda9a74 SNI Support (ported netty SniHandler) (#219)
* First cut commit *unfinished

* Replace SNI handler with TlsHandler with certificate selected based on host name found in clientHello

* first cut tests for SniHandler

* test update

* Test update

* Supress further read when handler is replaced

* made the snitest more effective and IDN in hostname lower case as per netty impl

* More asserts to check whether snihandler gets replaces with tlshaldler in the pipeline

* assert server name is always found in clienthello as per the test setup

* Provided option to select default host name in case of error or client hello does not contail SNI extension, otherwise handshake fails in those cases

* More elaborate tests

* verbosity in test

* Fixed Read continues to get called after handler removed and removed the workaround in SniHandler

* relaced goto statement with flag for breaking outer for loop from within switch

* Update SniHandler.cs

* trigger CI build

* addressed review comments

* Fixed task continuation option

* addresses further review comments

* triggere build again with some more assert in test #221

* suppress read logic is still needed due to async "void"

*  changing the map to (string -> Task<ServerTlsSettings)

* one more constructor overload

* extensive tls read/write test is not needed since that's already done in tlshandler test

* more readable target host validation in test to force retrigger confusing CI build

* retrigger

* addressed review comment "this generates 30 random data frames. pls replace with new [] { 1 }"
2017-03-29 02:27:53 -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 b2f10c28cb Fixes excessive exceptions from being thrown in case of graceful channel closure. (#152)
Motivation:
SocketException and ODE are being thrown when disconnecting gracefully.

Modifications:
- dismiss async read completion if it is done on inactive channel
- do not attempt sync-reading from a socket that is not Connected
- extra: fixing echo sample with better practices
- extra: ReadListener for more natural test scenarios
- extra: tweaked nbench spec to work in-loop

Result:
No excessive errors happen during graceful shutdown
2016-08-08 15:34:08 -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 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
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