File tree Expand file tree Collapse file tree
com.unity.netcode.gameobjects/Runtime/Transports/UTP Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1047,7 +1047,12 @@ public override bool StartClient()
10471047 return false ;
10481048 }
10491049
1050- return ClientBindAndConnect ( ) ;
1050+ var succeeded = ClientBindAndConnect ( ) ;
1051+ if ( ! succeeded )
1052+ {
1053+ Shutdown ( ) ;
1054+ }
1055+ return succeeded ;
10511056 }
10521057
10531058 public override bool StartServer ( )
@@ -1057,12 +1062,23 @@ public override bool StartServer()
10571062 return false ;
10581063 }
10591064
1065+ bool succeeded ;
10601066 switch ( m_ProtocolType )
10611067 {
10621068 case ProtocolType . UnityTransport :
1063- return ServerBindAndListen ( ConnectionData . ListenEndPoint ) ;
1069+ succeeded = ServerBindAndListen ( ConnectionData . ListenEndPoint ) ;
1070+ if ( ! succeeded )
1071+ {
1072+ Shutdown ( ) ;
1073+ }
1074+ return succeeded ;
10641075 case ProtocolType . RelayUnityTransport :
1065- return StartRelayServer ( ) ;
1076+ succeeded = StartRelayServer ( ) ;
1077+ if ( ! succeeded )
1078+ {
1079+ Shutdown ( ) ;
1080+ }
1081+ return succeeded ;
10661082 default :
10671083 return false ;
10681084 }
You can’t perform that action at this time.
0 commit comments