|
19 | 19 | using Unity.Networking.Transport.Relay; |
20 | 20 | using Unity.Networking.Transport.TLS; |
21 | 21 | using Unity.Networking.Transport.Utilities; |
22 | | -using UnityEditor.PackageManager; |
23 | 22 | using UnityEngine; |
24 | 23 |
|
25 | 24 | using NetcodeEvent = Unity.Netcode.NetworkEvent; |
@@ -1371,21 +1370,30 @@ public override void DisconnectRemoteClient(ulong clientId) |
1371 | 1370 | private const byte k_ClosedRemoteConnection = 128; |
1372 | 1371 | private const byte k_TransportShutdown = 129; |
1373 | 1372 |
|
| 1373 | + internal const string DisconnectedMessage = "Gracefully disconnected."; |
| 1374 | + internal const string TimeoutMessage = "Connection closed due to timed out."; |
| 1375 | + internal const string MaxConnectionAttemptsMessage = "Connection closed due to maximum connection attempts reached."; |
| 1376 | + internal const string ClosedByRemoteMessage = "Connection was closed by remote endpoint."; |
| 1377 | + internal const string AuthenticationFailureMessage = "Connection closed due to authentication failure."; |
| 1378 | + internal const string ProtocolErrorMessage = "Gracefully disconnected."; |
| 1379 | + internal const string ClosedRemoteConnectionMessage = "Local transport closed the remote endpoint connection."; |
| 1380 | + internal const string TransportShutdownMessage = "The transport was shutdown."; |
| 1381 | + |
1374 | 1382 | /// <inheritdoc/> |
1375 | 1383 | protected override void OnCreateDisconnectEventMap() |
1376 | 1384 | { |
1377 | 1385 | // Implemented in UTP |
1378 | 1386 |
|
1379 | | - AddDisconnectEventMap(DisconnectEvents.Disconnected, (byte)DisconnectReason.Default, "Gracefully disconnected."); |
1380 | | - AddDisconnectEventMap(DisconnectEvents.ProtocolTimeout, (byte)DisconnectReason.Timeout, "Connection timed out."); |
1381 | | - AddDisconnectEventMap(DisconnectEvents.MaxConnectionAttempts, (byte)DisconnectReason.MaxConnectionAttempts, "Maximum connection attempts reached."); |
1382 | | - AddDisconnectEventMap(DisconnectEvents.ClosedByRemote, (byte)DisconnectReason.ClosedByRemote, "Remote connection was closed."); |
1383 | | - AddDisconnectEventMap(DisconnectEvents.AuthenticationFailure, (byte)DisconnectReason.AuthenticationFailure, "Authentication failed."); |
1384 | | - AddDisconnectEventMap(DisconnectEvents.ProtocolError, (byte)DisconnectReason.ProtocolError, "Transport protocol error encountered."); |
| 1387 | + AddDisconnectEventMap(DisconnectEvents.Disconnected, (byte)DisconnectReason.Default, DisconnectedMessage); |
| 1388 | + AddDisconnectEventMap(DisconnectEvents.ProtocolTimeout, (byte)DisconnectReason.Timeout, TimeoutMessage); |
| 1389 | + AddDisconnectEventMap(DisconnectEvents.MaxConnectionAttempts, (byte)DisconnectReason.MaxConnectionAttempts, MaxConnectionAttemptsMessage); |
| 1390 | + AddDisconnectEventMap(DisconnectEvents.ClosedByRemote, (byte)DisconnectReason.ClosedByRemote, ClosedByRemoteMessage); |
| 1391 | + AddDisconnectEventMap(DisconnectEvents.AuthenticationFailure, (byte)DisconnectReason.AuthenticationFailure, AuthenticationFailureMessage); |
| 1392 | + AddDisconnectEventMap(DisconnectEvents.ProtocolError, (byte)DisconnectReason.ProtocolError, ProtocolErrorMessage); |
1385 | 1393 |
|
1386 | 1394 | // Not implemented in UTP |
1387 | | - AddDisconnectEventMap(DisconnectEvents.ClosedRemoteConnection, k_ClosedRemoteConnection, "Local transport closed the remote connection."); |
1388 | | - AddDisconnectEventMap(DisconnectEvents.TransportShutdown, k_TransportShutdown, "The transport was shutdown."); |
| 1395 | + AddDisconnectEventMap(DisconnectEvents.ClosedRemoteConnection, k_ClosedRemoteConnection, ClosedRemoteConnectionMessage); |
| 1396 | + AddDisconnectEventMap(DisconnectEvents.TransportShutdown, k_TransportShutdown, TransportShutdownMessage); |
1389 | 1397 |
|
1390 | 1398 | base.OnCreateDisconnectEventMap(); |
1391 | 1399 | } |
|
0 commit comments