Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Changelog

All notable changes to this project will be documented in this file.

## [0.1.0] - Unreleased

### Added
- Public `Session` constructor accepting `ITransport`, `isClient`, `leaveOpen`, and `SessionOptions`
- `ITransport.FlushAsync()` default interface method for transport-level flushing
- `ISessionChannel.FlushWritesAsync()` properly flushes to underlying transport
- `IAsyncDisposable` support on `ISessionChannel`
- `SessionOptions.SessionCloseTimeout` for configurable graceful shutdown
- `SessionOptions.MaxIncomingFrameSize` for defensive frame size validation
- `SessionOptions.ReadTimeout` for transport read timeout
- Graceful session shutdown: channels drain before force-close
- `ReusableValueTaskSourcePool` integrated into `ConnectionWriter` for TCS pooling
- RST frame sent for data frames on unknown streams (Yamux spec compliance)
- Channel immediately removed from `ChannelManager` on RST receipt
- `Nerdbank.Streams` and in-memory transport benchmarks
- New test suites: `SocketTransportTests`, `StressTests`, `ProtocolEdgeCaseTests`, `ErrorPathTests`

### Changed
- **Breaking:** Renamed extension parameter `keepOpen` to `leaveOpen` (.NET convention)
- **Breaking:** `CancellationToken? cancel` changed to `CancellationToken cancellationToken = default` on all public APIs
- **Breaking:** `FlushWritesAsync` return type changed from `Task` to `ValueTask`
- `Session` constructor access changed from `internal` to `public`
- Ping response is now awaited instead of fire-and-forget
- `ConfigureAwait(false)` added throughout library internals

### Fixed
- RTT calculation now correctly uses `Stopwatch.Frequency`
- `ConnectionReader` cancellation no longer falls through to garbage parse
- Channels properly removed from `ChannelManager` on all disposal paths
- `CloseOpenChannelsAsync` handles already-disposed channels gracefully
- `EnqueueFrame` now properly returns the TCS to pool on failure

### Security
- Max incoming frame size validation prevents memory exhaustion from malicious peers
69 changes: 69 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Contributing to Yamux

## Build

```bash
dotnet build
```

## Test

```bash
dotnet test
```

To run specific test categories:

```bash
dotnet test --filter "FullyQualifiedName~SessionTests"
dotnet test --filter "FullyQualifiedName~SocketTransportTests"
```

## Benchmarks

The benchmark project compares Yamux against raw TCP, Go Yamux, and Nerdbank.Streams.

```bash
dotnet run -c Release --project benchmarks/Yamux.Benchmark
```

To compare with the Go implementation, first build the Go server:

```bash
pwsh benchmarks/build-go-server.ps1
```

Then run the comparison:

```bash
pwsh benchmarks/compare.ps1
```

## Project Structure

```
src/Yamux.csproj — Main library
src/Protocol/ — Yamux wire protocol (frames, constants, enums)
src/Internal/ — Internal implementation (reader, writer, channel manager, etc.)
test/Yamux.Tests/ — xUnit test suite
benchmarks/Yamux.Benchmark/ — BenchmarkDotNet benchmarks
samples/Sample/ — Live statistics sample app
samples/FileTransfer/ — Multi-file transfer sample
docs/ — API documentation
```

## Code Style

- Follow existing code patterns and naming conventions
- Use `ConfigureAwait(false)` in all library code
- Name CancellationToken parameters `cancellationToken`
- Prefer `ValueTask` over `Task` for hot-path async operations
- XML doc comments on all public APIs

## Pull Requests

1. Fork the repository
2. Create a feature branch
3. Make changes and add tests
4. Ensure `dotnet build` and `dotnet test` pass
5. Submit a PR with a clear description
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<VersionPrefix>0.0.5</VersionPrefix>
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>
<VersionPrefix>0.0.6</VersionPrefix>
<VersionSuffix>rc1</VersionSuffix>
<Authors>Paul Bleess</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
Loading
Loading