Skip to content

Commit

Permalink
Increased default max resend attempts for reliable messages to withst…
Browse files Browse the repository at this point in the history
…and much higher loss rates
  • Loading branch information
tom-weiland committed Jun 18, 2021
1 parent 0b234a7 commit 82c06f8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions RiptideNetworking/RiptideNetworking/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ internal override void ReliableHandle(byte[] data, IPEndPoint fromEndPoint, Head
/// <summary>Sends a message to the server.</summary>
/// <param name="message">The message to send.</param>
/// <param name="maxSendAttempts">How often to try sending a reliable message before giving up.</param>
public void Send(Message message, byte maxSendAttempts = 3)
public void Send(Message message, byte maxSendAttempts = 15)
{
if (message.SendMode == MessageSendMode.unreliable)
Send(message.Bytes, message.WrittenLength, remoteEndPoint);
Expand Down Expand Up @@ -332,7 +332,7 @@ internal void SendWelcomeReceived()
Message message = Message.CreateInternal(HeaderType.welcome);
message.Add(Id);

Send(message, 5);
Send(message, 25);
}

/// <summary>Handles a client connected message.</summary>
Expand Down
10 changes: 5 additions & 5 deletions RiptideNetworking/RiptideNetworking/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private ushort GetAvailableClientId()
/// <param name="message">The message to send.</param>
/// <param name="toClient">The client to send the message to.</param>
/// <param name="maxSendAttempts">How often to try sending a reliable message before giving up.</param>
public void Send(Message message, ServerClient toClient, byte maxSendAttempts = 3)
public void Send(Message message, ServerClient toClient, byte maxSendAttempts = 15)
{
if (message.SendMode == MessageSendMode.unreliable)
Send(message.Bytes, message.WrittenLength, toClient.remoteEndPoint);
Expand All @@ -250,7 +250,7 @@ public void Send(Message message, ServerClient toClient, byte maxSendAttempts =
/// <summary>Sends a message to all conected clients.</summary>
/// <param name="message">The message to send.</param>
/// <param name="maxSendAttempts">How often to try sending a reliable message before giving up.</param>
public void SendToAll(Message message, byte maxSendAttempts = 3)
public void SendToAll(Message message, byte maxSendAttempts = 15)
{
lock (clients)
{
Expand All @@ -271,7 +271,7 @@ public void SendToAll(Message message, byte maxSendAttempts = 3)
/// <param name="message">The message to send.</param>
/// <param name="exceptToClient">The client NOT to send the message to.</param>
/// <param name="maxSendAttempts">How often to try sending a reliable message before giving up.</param>
public void SendToAll(Message message, ServerClient exceptToClient, byte maxSendAttempts = 3)
public void SendToAll(Message message, ServerClient exceptToClient, byte maxSendAttempts = 15)
{
lock (clients)
{
Expand Down Expand Up @@ -362,7 +362,7 @@ private void SendClientConnected(IPEndPoint endPoint, ushort id)
lock (clients)
foreach (ServerClient client in clients.Values)
if (!client.remoteEndPoint.Equals(endPoint))
Send(message, client, 5);
Send(message, client, 25);
}

/// <summary>Sends a client disconnected message.</summary>
Expand All @@ -374,7 +374,7 @@ private void SendClientDisconnected(ushort id)

lock (clients)
foreach (ServerClient client in clients.Values)
Send(message, client, 5);
Send(message, client, 25);
}
#endregion

Expand Down
2 changes: 1 addition & 1 deletion RiptideNetworking/RiptideNetworking/ServerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ internal void SendWelcome()
Message message = Message.CreateInternal(HeaderType.welcome);
message.Add(Id);

server.Send(message, this, 5);
server.Send(message, this, 25);
}

/// <summary>Handles a welcome message.</summary>
Expand Down

0 comments on commit 82c06f8

Please sign in to comment.