ModernUO/Projects/UOContent/Misc
Kamron Batman 3c0d6cb9d6
feat: Upgrades networking to use io_uring. (#2315)
> [!IMPORTANT]
> **Breaking Changes**
> - DecodePacket and EncodePacket delegates replaced with IClientEncryption interface
> - NetState.Connection (Socket) replaced with internal RingSocket management
> - NetState.RecvPipe and NetState.SendPipe removed (buffers managed internally)

## Summary

Upgrades the networking stack from PollGroup-based I/O to io_uring, significantly improving I/O performance on Linux.
This also adds native client encryption support for encrypted UO clients.

## Major Changes

io_uring Networking Architecture
- Replaced PollGroup with IORingGroup for async socket I/O operations
- Removed Pipe.cs (mirrored ring buffer) and TcpServer.cs in favor of RingSocketManager
- Added NetState.Network.cs - centralized network infrastructure handling accept, recv, send, and disconnect
completions
- Added SocketHelper.cs - platform-specific socket utilities for raw socket handle operations (getpeername,
getsockname)
- Buffer management now handled by RingSocketManager with configurable slab allocation

### Client Encryption Support
- Added full encryption stack in Network/Encryption/:
  - EncryptionConfig.cs - configurable encryption modes (None, Unencrypted, Encrypted, Both)
  - EncryptionManager.cs - encryption detection and initialization for login/game packets
  - LoginEncryption.cs - handles login packet encryption with version-derived keys
  - GameEncryption.cs - handles game server encryption using Twofish
  - TwofishEngine.cs - optimized Twofish block cipher implementation
  - LoginKeys.cs - encryption key table for client versions
  - IClientEncryption.cs - interface for client encryption implementations

### NetState Improvements
- Replaced Socket Connection with RingSocket _socket for managed socket lifecycle
- Changed from GCHandle polling to event-based completion processing
- Disconnect handling now properly waits for pending sends to flush
- Simplified connecting socket management using lazy queue removal

### Configuration
- New settings: network.encryptionMode and network.encryptionDebug
- Encryption mode flags: Unencrypted, Encrypted, or Both

### Dependencies
- Replaced PollGroup NuGet package with IORingGroup
- Linux requires liburing-dev / liburing-devel package

### Test plan

- Verify server starts and accepts connections on Linux with io_uring
- Verify server starts and accepts connections on Windows (fallback to IOCP)
- Test unencrypted client connections (ClassicUO with encryption disabled)
- Test encrypted client connections if available
- Verify graceful disconnect flushes pending data
- Confirm CI builds pass on all target platforms
2026-02-01 16:02:32 -08:00
..
AccountPrompt.cs fix: Fixes console clobbering when prompted to add an owner account (#2133) 2025-02-26 18:43:20 -08:00
AdminFirewall.cs fix: Fixes TCPServer accept async, makes Firewall/IP Limiter multithreaded (#2134) 2025-02-27 22:19:38 -08:00
Animations.cs fix: Moves many EventSinks out of core. (#1783) 2024-05-21 10:02:30 -07:00
AOS.cs feat: Adds PlayerDeathEvent and CreatureDeathEvent using code generated events (#1927) 2024-09-05 21:23:03 -07:00
AttackMessage.cs fix: Fixes crafter deserialize, cleans up bandages, and codegens misc items (#1350) 2023-02-25 00:54:12 -08:00
AutoRestart.cs fix: Fixes missing methods. Adds more admin gump world building (#1675) 2024-02-10 20:31:25 -08:00
Broadcasts.cs Fixes exiting/crash handling/ctrl+c (#237) 2020-09-12 00:05:38 -07:00
Cleanup.cs fix: Fixes structured logging (#1043) 2022-06-05 01:00:22 -07:00
ClientVerification.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
CrashGuard.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
DispellableAttribute.cs Formats UO Content (#201) 2020-08-27 18:30:38 -07:00
DispellableFieldAttribute.cs Formats UO Content (#201) 2020-08-27 18:30:38 -07:00
DoorGenerator.cs feat: Adds wall z-offset detection for doorgen (#2025) 2024-12-17 10:40:02 -08:00
Email.cs fix: Fixes spawn entry deserialization (#1693) 2024-03-03 08:45:16 -08:00
Emitter.cs Fixes brace style (#248) 2020-09-13 21:49:46 -07:00
FoodDecay.cs feat: Moves TcpServer to another thread. Rewrites Firewall (#1660) 2024-01-20 14:25:12 -08:00
Geometry.cs chore: Cleans up pattern checks. (#892) 2021-12-24 15:53:59 -08:00
Guild.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
HardwareInfo.cs fix: Fixes thread guard and cleans up incoming packet reader (#1641) 2023-12-19 17:04:09 -08:00
InhumanSpeech.cs feat: Replaces params array with params ReadOnlySpan (#2125) 2025-02-13 21:19:02 -08:00
Keywords.cs fix: Overhauls murder system (#1419) 2023-07-15 22:42:49 -07:00
LanguageStatistics.cs fix: Adds command help, webpage, and fixes issues with other commands (#1669) 2024-02-10 00:19:19 -08:00
LightCycle.cs fix: Fixes buffs don't start/stop properly. Streamlines constructor and Add/Remove buffs. (#2082) 2025-01-24 18:20:23 -08:00
LoginStats.cs feat: Converts OnLogin to a coded generated event (#2070) 2025-01-17 15:21:45 -08:00
Loot.cs feat: Replaces params array with params ReadOnlySpan (#2125) 2025-02-13 21:19:02 -08:00
LootPack.cs fix: Consolidates Color/Center html (#1762) 2024-05-07 23:56:32 -07:00
MessageHelper.cs fix: Codegens rares and solen items (#1371) 2023-03-11 19:25:48 -08:00
MondainsLegacy.cs fix: Consolidates Color/Center html (#1762) 2024-05-07 23:56:32 -07:00
NameList.cs fix: Cleans up murder system (#1428) 2023-07-16 00:04:30 -07:00
NameVerification.cs fix: Fixes detecting consecutive exceptions in name validation (#2192) 2025-05-18 21:02:05 -07:00
Notoriety.cs fix: Fixes EVs/BSs attacking players in Pre-AOS (#2132) 2025-02-26 18:43:49 -08:00
PacketThrottles.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Paperdoll.cs fix(core): Converts remaining player packets (#374) 2020-12-30 16:09:51 -08:00
Poison.cs fix: Overhauls virtue system (#1376) 2023-07-19 21:43:47 -07:00
ProfanityProtection.cs fix: Fixes and optimizes NameVerification and ProfanityProtection (#2153) 2025-04-12 02:26:10 -07:00
ProfessionInfo.cs feat: Moves network related events to UOContent using code generation (#1945) 2024-09-06 16:57:10 -07:00
Profile.cs fix: Moves many EventSinks out of core. (#1783) 2024-05-21 10:02:30 -07:00
RaceDefinitions.cs fix: Updates races to properly support gargoyle equipment. (#744) 2021-08-29 00:43:55 -07:00
RegenRates.cs fix: Fixes poison field duration, cleans up skill calculations and poison calculations (#1582) 2023-11-04 12:32:54 -07:00
RenameRequests.cs fix: Fixes and optimizes NameVerification and ProfanityProtection (#2153) 2025-04-12 02:26:10 -07:00
ResourceInfo.cs fix: Codegens BOD rewards. (#1361) 2023-03-06 19:01:14 -08:00
ServerAccess.cs fix: Reverts GetAccount to use IAccount. Adds IAccount to serialization. (#1565) 2023-10-25 19:17:57 -07:00
ServerList.cs feat: Upgrades networking to use io_uring. (#2315) 2026-02-01 16:02:32 -08:00
ShardPoller.cs feat: Adds size/style support to gump builders, optimizes EscapeHtml (#2257) 2025-11-23 11:35:31 -08:00
ShrinkTable.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
StaffInfo.cs fix: Codegens gifts. Unifies staff names. Thank you to the community! (#1766) 2024-05-08 20:44:00 -07:00
StaminaSystem.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Titles.cs fix: Fix Lord/Lady title display in paperdoll when fame >= 10000 (#2022) 2024-12-16 12:28:52 -08:00
ToggleItem.cs fix: Codegens house/vendors (#1767) 2024-05-08 22:45:59 -07:00
TreasureMapProtection.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
ValidationQueue.cs Fixes brace style (#248) 2020-09-13 21:49:46 -07:00
Weather.cs fix: Moves containers/bods/traps/etc to serialization generator (#2310) 2026-01-07 21:55:55 -08:00
WelcomeTimer.cs Removes UOAM vendors. (#241) 2020-09-12 11:56:52 -07:00