-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to disable UPnP port forwarding (#1547)
* Added option to disable UPnP port forwarding
- Loading branch information
Showing
19 changed files
with
215 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Threading; | ||
|
||
namespace NitroxModel.DataStructures | ||
{ | ||
public sealed class AtomicBool | ||
{ | ||
private int backingValue; | ||
|
||
public bool Value | ||
{ | ||
get => Interlocked.CompareExchange(ref backingValue, 1, 1) == 1; | ||
set | ||
{ | ||
if (value) | ||
{ | ||
Interlocked.CompareExchange(ref backingValue, 1, 0); | ||
} | ||
else | ||
{ | ||
Interlocked.CompareExchange(ref backingValue, 0, 1); | ||
} | ||
} | ||
} | ||
|
||
public static implicit operator bool(AtomicBool b) | ||
{ | ||
return b.Value; | ||
} | ||
|
||
/// <summary> | ||
/// Sets the bool to true if it's false. | ||
/// </summary> | ||
/// <returns>Returns true if the bool was just set to true and wasn't already true.</returns> | ||
public bool GetAndSet() | ||
{ | ||
return Interlocked.CompareExchange(ref backingValue, 1, 0) == 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
NitroxServer/Communication/Packets/Processors/Abstract/UnauthenticatedPacketProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
NitroxServer/Communication/Packets/Processors/MultiplayerSessionPolicyRequestProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...xServer/Communication/Packets/Processors/MultiplayerSessionReservationRequestProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.