Skip to content

Commit

Permalink
fix: auto-disable DontFragment if it fails
Browse files Browse the repository at this point in the history
  • Loading branch information
lodicolo committed Oct 1, 2023
1 parent 18231fb commit 3f784bd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: actions/[email protected]
with:
name: '${{ needs.build.outputs.artifact_name }}'
- name: Publish Release nupkg
run: dotnet nuget push 'Release/${{ needs.build.outputs.nupkg_base_name }}.nupkg' --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.LIDGREN_NUGET_API_KEY }}
- name: Publish Debug nupkg
run: dotnet nuget push 'Debug/${{ needs.build.outputs.nupkg_base_name }}-debug.nupkg' --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.LIDGREN_NUGET_API_KEY }}
- name: Publish Release nupkg
run: dotnet nuget push 'Release/${{ needs.build.outputs.nupkg_base_name }}.nupkg' --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.LIDGREN_NUGET_API_KEY }}
19 changes: 18 additions & 1 deletion Lidgren.Network/NetSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ namespace Lidgren.Network
{
public class NetSocket : INetSocket
{
private static bool _dontFragmentUnsupported;

private Socket Socket { get; set; }

public int ReceiveBufferSize {
Expand All @@ -25,7 +27,22 @@ public bool Blocking {
public bool DontFragment
{
get => Socket.DontFragment;
set => Socket.DontFragment = value;
set
{
if (_dontFragmentUnsupported)
{
return;
}

try
{
Socket.DontFragment = value;
}
catch
{
_dontFragmentUnsupported = true;
}
}
}

public bool DualMode {
Expand Down

0 comments on commit 3f784bd

Please sign in to comment.