-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Networking Enhancements #4
Conversation
-Fix server crash on hard disconnect -Detect client disconnect -Remove player object from server+other clients when disconnected -Disconnect packet added -Disconnect command added
-Made Disconnect packet serializable -Wrapped Socket read/writes in try/catch blocks -Made playersById in Listener a Dictionary with outside locking --Internal synchronization will not work against outside iteration+modification --Don't use two locks for no reason; ConcurrentMap is no longer needed -Round two for trying to remove inactive player objects
-Only allowed to connect to one server at a time -Display connected/disconnected messages in-game -Fixed Disconnect packet processing (round 3) -Fixed multiple Mono Behavior loading -Only process packets if connected to server --Possible issue: Packets will be sent, user will disconnect, the next reconnect will process these old packets first -More error handling - server should not crash from connects/disconnects
-Fixed ClientTester crash -Fixed issue where a disconnection without authenticating would cause a server crash
@@ -14,7 +14,10 @@ namespace NitroxServer | |||
{ | |||
public class Listener | |||
{ | |||
private ConcurrentMap<String, Player> playersById = new ConcurrentMap<String, Player>(); | |||
// A ConcurrentMap will not protect against concurrency issues when |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
NitroxServer/Listener.cs
Outdated
} | ||
} | ||
} | ||
|
||
private void SendCompleted(IAsyncResult ar) | ||
{ | ||
Thread.Sleep(40); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
[Serializable] | ||
public class Disconnect : Packet | ||
{ | ||
|
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
if (connection.Open) | ||
{ | ||
connection.BeginReceive(new AsyncCallback(DataReceived)); | ||
} else |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
private void outputMessage(String msg) | ||
{ | ||
if (testClient) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Networking Enhancements
.ToHashSet() doesn't exist in .NetStandard
Fix server crashes due to network read/write failures, Socket failures. Remove player model when disconnected.