Core/Networking: Fix infinite loop and deadlock when closing socket.
This commit is contained in:
@@ -119,7 +119,7 @@ namespace Framework.Networking
|
||||
|
||||
public void CloseSocket()
|
||||
{
|
||||
if (_socket == null)
|
||||
if (_socket == null || !_socket.Connected)
|
||||
return;
|
||||
|
||||
try
|
||||
|
||||
@@ -74,7 +74,10 @@ namespace Game
|
||||
for (byte i = 0; i < 2; ++i)
|
||||
{
|
||||
if (m_Socket[i] != null)
|
||||
{
|
||||
m_Socket[i].CloseSocket();
|
||||
m_Socket[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
// empty incoming packet queue
|
||||
|
||||
Reference in New Issue
Block a user