Commit Graph

93 Commits

Author SHA1 Message Date
ike709
c2ca7c7811 .NET 9 (#5552)
Co-authored-by: ike709 <ike709@github.com>
2025-01-06 01:16:01 +01:00
Pieter-Jan Briers
c83720b163 Update Lidgren to v0.3.1 2024-05-06 01:55:05 +02:00
Pieter-Jan Briers
0fb41e06c8 Upgrade to Lidgren v0.3.0 2024-03-23 16:21:34 +01:00
Pieter-Jan Briers
af98933173 Isolate net messages in integration tests. (#4838)
* Isolate net messages in integration tests.

Integration tests don't use Lidgren to connect client and send, instead they just use some in-process channels to communicate. Because of this, the original implementation of net messages *directly* passed the net message instances between client and server instances. This caused issues whenever content would mutate data in a NetMessage after it "passed through".

Now we run the messages through WriteToBuffer() and ReadFromBuffer() so they pass through binary serialization. This means there's no more implicit sharing of the objects.

Note that this requires some trickery: Lidgren's message types have internal constructors. Really ideally we'd change the engine to make this more testable... but that's a content breaking change. Instead I just added InternalsVisibleTo to Lidgren so we can mess with it. We maintain the library ourselves anyways I can do what I want.

Fixes #4836

* Register Robust.UnitTesting as assembly for reflection.

This is necessary so that serialized types in the assembly can be picked up by NetSerializer.

Have to disable automatic reflection on all entity systems/components that tests register manually right now, because otherwise tests break.

* Stop shallow cloning specific net messages in integration tests.

This isn't necessary anymore now that we have a thorough fix.

* Wow I really forgot to copy-paste that line to the other side huh.

* Add test that serializer hash matches.

* Another test one I missed earlier.

* Changelog
2024-01-16 21:04:39 +01:00
Pieter-Jan Briers
f5b1c26bec Update Lidgren to fix nullable compilation issue 2023-12-15 18:28:10 +01:00
Pieter-Jan Briers
4c79d0c6d0 .NET 8 (#4712) 2023-12-15 18:07:41 +01:00
Pieter-Jan Briers
dc96318379 Fix Lidgren compile on GitHub hopefully 2023-12-13 19:08:08 +01:00
Pieter-Jan Briers
331e1fcc81 Update Lidgren to v0.2.7
This adds NRT annotations. Fix compatibility with those.
2023-12-13 00:06:00 +01:00
Pieter-Jan Briers
ab5db4641c Update Lidgren to v0.2.6 2023-08-27 13:18:19 +02:00
Pieter-Jan Briers
35902ad839 Update Lidgren to fix Linux socket error reporting. 2023-06-18 18:19:08 +02:00
metalgearsloth
8a6cadd38f Revert "Revert "Replace ResourcePath with ResPath (#3926)" (#3949)" (#3950) 2023-04-20 20:15:57 +10:00
metalgearsloth
d646403068 Revert "Replace ResourcePath with ResPath (#3926)" (#3949) 2023-04-20 11:43:51 +10:00
Ygg01
d6a3e1e286 Replace ResourcePath with ResPath (#3926) 2023-04-19 23:37:46 +10:00
Pieter-Jan Briers
3bce8d82e5 Update Lidgren to v0.2.4. 2023-03-07 22:47:50 +01:00
Pieter-Jan Briers
23fd4e1843 Refactor MSBuild spaghetti, new configurations. (#3807) 2023-03-06 11:12:08 -08:00
Pieter-Jan Briers
31d68dcd49 .NET 7 compilation fixes. 2022-11-10 01:26:05 +01:00
Pieter-Jan Briers
582e705088 Update Lidgren to v0.2.2 2022-10-01 00:06:55 +02:00
Pieter-Jan Briers
cf893c3c32 Avoid rogue obj/ folders breaking Lidgren build. 2022-10-01 00:06:55 +02:00
Pieter-Jan Briers
3a5cc20a88 Compile Lidgren net6.0, change assembly name. 2022-10-01 00:06:55 +02:00
Pieter-Jan Briers
3ae4bb03f5 Enable NetManager latency sim on release, add no-bye to INetChannel.
A minute amount of tomfoolery.
2022-05-09 15:43:30 +02:00
Pieter-Jan Briers
237e37ff30 Update Lidgren submodule 2022-04-14 23:47:17 +02:00
Pieter-Jan Briers
de8c2c14bb Replace Lidgren encryption stuff with Libsodium (#2646) 2022-04-02 16:24:04 +02:00
20kdc
e7a0409645 Status host uses net.port by default, add UPnP port forwarding option (#2237)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2021-11-21 15:19:39 +01:00
Pieter-Jan Briers
02d2bd31e7 Update Lidgren submodule; re-enable encryption. 2021-11-09 19:34:55 +01:00
Pieter-Jan Briers
8ef95f0199 Update Lidgren 2021-10-15 15:59:44 +02:00
Pieter-Jan Briers
655ecbab45 Update Lidgren submodule 2021-10-14 19:18:35 +02:00
Pieter-Jan Briers
94708881b3 Update Lidgren.
Optimizes Socket usage to remove allocations, minor bugfixes.
2021-10-13 15:55:04 +02:00
Pieter-Jan Briers
ef2f81a77a Update NetSerializer and Lidgren submodules.
Lidgren has slightly better buffer management, NetSerializer has NetListAsArray<T>.
2021-10-05 14:37:39 +02:00
Pieter-Jan Briers
73e62414a7 Update Lidgren and NetSerializer submodules 2021-08-22 11:08:43 +02:00
Pieter-Jan Briers
765a560380 Fix integer overflow breaking Lidgren metrics. 2021-03-25 01:47:45 +01:00
Pieter-Jan Briers
6973d43006 Network timing synchronization.
Lidgren NetTime.Now is now synchronized to IGameTiming.RealTime.

NetChannel is now a nested class of NetManager.

Add IGameTiming.ServerTime, INetChannel.RemoteTimeOffset, INetChannel.RemoteTime
2021-02-09 14:28:20 +01:00
Pieter-Jan Briers
78ceaa50d5 Update Lidgren submodule. 2020-12-16 18:18:40 +01:00
Pieter-Jan Briers
bf197ce04b Update lidgren and netserializer submodules 2020-11-26 01:19:36 +01:00
Pieter-Jan Briers
8ef13e6918 Update Lidgren and NetSerializer submodules. 2020-11-11 00:43:58 +01:00
Pieter-Jan Briers
2386fedd25 Update Lidgren 2020-10-12 17:07:09 +02:00
Pieter-Jan Briers
cabb9859ec Move Lidgren to submodule 2020-10-10 23:32:37 +02:00
Acruid
2b3f419e3c Adds PeekStringSize() to the lidgren netbuffer, which allows you to get the size in bytes of the string without actually decoding the string. 2020-09-06 09:30:55 -07:00
Pieter-Jan Briers
f5e23fc710 Fix Lidgren crashing if lo is the only available network adapter. 2020-08-26 16:25:31 +02:00
Víctor Aguilera Puerto
a3dfa49798 Fix typo in lidgren 2020-08-11 17:51:19 +02:00
Pieter-Jan Briers
0b302b5171 Move a Span<byte> -> ReadOnlySpan<byte> in NetBuffer.Write.cs 2020-07-30 15:06:45 +02:00
Pieter-Jan Briers
31c964b9d7 Fix IPv6 sockets on Linux.
By removing Q's NativeSockets layer and just using byte[] again.

There's no performance loss because byte[] was already the only thing used.
2020-06-26 02:37:12 +02:00
Pieter-Jan Briers
ff68a70aef More lidgren stats exposed to prometheus. 2020-06-25 02:27:20 +02:00
Pieter-Jan Briers
f71f2821d1 Fix latency simulation. 2020-06-25 02:27:19 +02:00
Tyler Young
faff0797bf Make Lidgren Use Spans & Shared Pool (#1140)
* make lidgren use spans everywhere where it can

convert custom pooling to shared array pool impl

add unit tests for read/write

add native socket extensions to socket so we can legit pass spans for SendTo/ReceiveFrom

bump version in lidgren csproj

replace some random "% 8" w/ "& 7"

more minor nullability hacks to fix static analysis complaints

made receiving packets use span

minor native sockets refactor to use pinvoke

add read/write constrained/prealloc'd bit stream impl to lidgren and update usages

fixed missing stream cleanup

remove outstanding stream cleanup since it refs buffer thru the class, can't read some other buf

apply suggestions from code review

remove unsafe cruft

* add tests to gh actions

* make stats use interpolation in tostring and remove m_bytesAllocated since it's all in the shared pool now

* this pr still open so fuck it

stats, human readability, faster BitsToHold methods

* add api compatible version of ReadBytes

* rename ReadOnlyStreamWrapper -> ReadOnlyWrapperStream

rename WriteOnlyStreamWrapper -> WriteOnlyWrapperStream

add AppendViaStream, AppenderStream impl

add and update documentation on read/write bytes methods

also fix some goofs
2020-06-24 04:09:20 +02:00
Pieter-Jan Briers
15ec0e7bd9 Adds missing Lidgren license. 2020-06-13 03:10:18 +02:00
Pieter-Jan Briers
dd0cb9f216 Prometheus metrics server.
Thanks to Redline for starting work on this and helping me out on Discord.
2020-06-08 00:12:23 +02:00
Pieter-Jan Briers
a0c1415873 Update Lidgren to master from the repo. (#979)
Should improve stability or whatever. Also some convenient stream features.
2020-02-15 01:21:30 +01:00
Pieter-Jan Briers
b32f695509 Make Sonar ignore Lidgren. 2019-05-29 01:18:36 +02:00
Pieter-Jan Briers
bb4a1eda8e Project file refactor (#819)
* Project file refactor

Move all the .csproj files to the new .NET Core style.
This doesn't make any difference for compiling for Framework,
but it does reduce a ton of useless boilerplate.

As an extension of this, killed a bunch of uncompiled & unmaintained .cs files.

Compiling for release (to profile) works now.
Removed AnyCPU targets from the solution file.

* Fix compiler warnings.
2019-05-28 00:16:01 +02:00
Pieter-Jan Briers
1fd6488362 Use Dns.GetHostEntryAsync.
I can't believe I missed this in the documentation.
2019-05-11 16:10:57 +02:00