Skip to content

Commit bcac45b

Browse files
fix: wrong base class for ClientConnectedState [MTT-5293] (#801)
* set ClientConnectedState inheriting from OnlineState * moved k_DtlsConnType constant to ConnectionMethod where it is used
1 parent c5f0f25 commit bcac45b

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

Assets/Scripts/ConnectionManagement/ConnectionMethod.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public abstract class ConnectionMethodBase
2121
protected ConnectionManager m_ConnectionManager;
2222
readonly ProfileManager m_ProfileManager;
2323
protected readonly string m_PlayerName;
24+
protected const string k_DtlsConnType = "dtls";
2425

2526
public abstract Task SetupHostConnectionAsync();
2627

@@ -128,7 +129,7 @@ public override async Task SetupClientConnectionAsync()
128129

129130
// Configure UTP with allocation
130131
var utp = (UnityTransport)m_ConnectionManager.NetworkManager.NetworkConfig.NetworkTransport;
131-
utp.SetRelayServerData(new RelayServerData(joinedAllocation, OnlineState.k_DtlsConnType));
132+
utp.SetRelayServerData(new RelayServerData(joinedAllocation, k_DtlsConnType));
132133
}
133134

134135
public override async Task SetupHostConnectionAsync()
@@ -152,7 +153,7 @@ public override async Task SetupHostConnectionAsync()
152153

153154
// Setup UTP with relay connection info
154155
var utp = (UnityTransport)m_ConnectionManager.NetworkManager.NetworkConfig.NetworkTransport;
155-
utp.SetRelayServerData(new RelayServerData(hostAllocation, OnlineState.k_DtlsConnType)); // This is with DTLS enabled for a secure connection
156+
utp.SetRelayServerData(new RelayServerData(hostAllocation, k_DtlsConnType)); // This is with DTLS enabled for a secure connection
156157
}
157158
}
158159
}

Assets/Scripts/ConnectionManagement/ConnectionState/ClientConnectedState.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Unity.BossRoom.ConnectionManagement
99
/// Connection state corresponding to a connected client. When being disconnected, transitions to the
1010
/// ClientReconnecting state if no reason is given, or to the Offline state.
1111
/// </summary>
12-
class ClientConnectedState : ConnectionState
12+
class ClientConnectedState : OnlineState
1313
{
1414
[Inject]
1515
protected LobbyServiceFacade m_LobbyServiceFacade;
@@ -39,11 +39,5 @@ public override void OnClientDisconnect(ulong _)
3939
m_ConnectionManager.ChangeState(m_ConnectionManager.m_Offline);
4040
}
4141
}
42-
43-
public override void OnUserRequestedShutdown()
44-
{
45-
m_ConnectStatusPublisher.Publish(ConnectStatus.UserRequestedDisconnect);
46-
m_ConnectionManager.ChangeState(m_ConnectionManager.m_Offline);
47-
}
4842
}
4943
}

Assets/Scripts/ConnectionManagement/ConnectionState/OnlineState.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ namespace Unity.BossRoom.ConnectionManagement
55
/// </summary>
66
abstract class OnlineState : ConnectionState
77
{
8-
public const string k_DtlsConnType = "dtls";
9-
108
public override void OnUserRequestedShutdown()
119
{
1210
// This behaviour will be the same for every online state

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
1414
### Fixed
1515
* EnemyPortals' VFX get disabled and re-enabled once the breakable crystals are broken (#784)
1616
* Elements inside the Tank's and Rogue's AnimatorTriggeredSpecialFX list have been revised to not loop AudioSource clips, ending the logging of multiple warnings to the console (#785)
17+
* ClientConnectedState now inherits from OnlineState instead of the base ConnectionState (#801)
1718

1819
## [2.0.4] - 2022-12-13
1920
### Changed

0 commit comments

Comments
 (0)