Skip to content

Commit

Permalink
client is connected and quality disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
copperdevs committed Feb 19, 2024
1 parent 060d1ee commit be3f754
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions CopperMatchmaking/Client/MatchmakerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class MatchmakerClient
/// <summary>
/// Enabled when <see cref="Update"/> needs to be ran to update the client.
/// </summary>
public bool ShouldUpdate => Client.IsConnected;
public bool ShouldUpdate { get; private set; }

internal readonly RiptideClient Client;
internal readonly IClientHandler Handler;
Expand Down Expand Up @@ -47,16 +47,19 @@ public MatchmakerClient(string ip, IClientHandler clientHandler, byte rankId, ul

// start riptide crap
Client = new RiptideClient(new TcpClient());
ShouldUpdate = true;

Client.Connect($"{ip}:7777", 5, 0, null, false);
Client.Connection.CanQualityDisconnect = true;

Client.Connection.CanQualityDisconnect = false;
Client.Connected += ClientConnectedHandler;
Client.MessageReceived += ClientMessageHandlers.ClientReceivedMessageHandler;
Client.Disconnected += ClientDisconnectedHandler;
}

~MatchmakerClient()
{
ShouldUpdate = false;
Client.Connected -= ClientConnectedHandler;
Client.MessageReceived -= ClientMessageHandlers.ClientReceivedMessageHandler;
Client.Disconnected -= ClientDisconnectedHandler;
Expand Down
2 changes: 1 addition & 1 deletion CopperMatchmaking/Server/ServerMessageHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal static void ClientJoinedMessageHandler(ushort sender, Message receivedM
return;
}

connection.CanQualityDisconnect = true;
connection.CanQualityDisconnect = false;

MatchmakerServer.Instance.RegisterClient(new ConnectedClient(rank, connection, playerId));
}
Expand Down

0 comments on commit be3f754

Please sign in to comment.