File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Assets/BossRoom/Scripts/Shared/Net/ConnectionManagement Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ public void OnUserDisconnectRequest()
117
117
}
118
118
119
119
// only do it here if we are not the host. The host will do it in ServerGameNetPortal
120
- if ( ! m_Portal . NetManager . IsHost )
120
+ if ( ! m_Portal . NetManager . IsHost && m_Portal . NetManager . IsListening )
121
121
{
122
122
m_Portal . NetManager . Shutdown ( ) ;
123
123
}
@@ -199,7 +199,11 @@ private IEnumerator TryToReconnect(string lobbyCode)
199
199
int nbTries = 0 ;
200
200
while ( nbTries < k_NbReconnectAttempts )
201
201
{
202
- NetworkManager . Singleton . Shutdown ( ) ;
202
+ if ( NetworkManager . Singleton . IsListening )
203
+ {
204
+ NetworkManager . Singleton . Shutdown ( ) ;
205
+ }
206
+
203
207
yield return new WaitWhile ( ( ) => NetworkManager . Singleton . ShutdownInProgress ) ; // wait until NetworkManager completes shutting down
204
208
Debug . Log ( $ "Reconnecting attempt { nbTries + 1 } /{ k_NbReconnectAttempts } ...") ;
205
209
if ( ! string . IsNullOrEmpty ( lobbyCode ) )
@@ -227,7 +231,7 @@ private IEnumerator TryToReconnect(string lobbyCode)
227
231
m_LobbyServiceFacade . ForceLeaveLobbyAttempt ( ) ;
228
232
if ( NetworkManager . Singleton . IsListening )
229
233
{
230
- NetworkManager . Singleton . Shutdown ( ) ;
234
+ NetworkManager . Singleton . Shutdown ( ) ;
231
235
}
232
236
233
237
SceneLoaderWrapper . Instance . LoadScene ( "MainMenu" ) ;
Original file line number Diff line number Diff line change @@ -145,7 +145,11 @@ IEnumerator WaitToShutdown()
145
145
yield return null ; // todo still needed? wait for UTP's update for it to send it's batched messages
146
146
yield return null ;
147
147
SessionManager < SessionPlayerData > . Instance . OnUserDisconnectRequest ( ) ;
148
- m_Portal . NetManager . Shutdown ( ) ;
148
+ if ( m_Portal . NetManager . IsListening )
149
+ {
150
+ m_Portal . NetManager . Shutdown ( ) ;
151
+ }
152
+
149
153
SceneLoaderWrapper . Instance . IsClosingClients = false ;
150
154
}
151
155
You can’t perform that action at this time.
0 commit comments