You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-06 02:11:06 +09:00
don't take double lock unnecessarily
This commit is contained in:
@@ -232,19 +232,19 @@ namespace Lidgren.Network
|
||||
foreach (var conn in m_connections)
|
||||
if (conn != null)
|
||||
list.Add(conn);
|
||||
|
||||
lock (m_handshakes)
|
||||
{
|
||||
foreach (var hs in m_handshakes.Values)
|
||||
if (hs != null)
|
||||
list.Add(hs);
|
||||
|
||||
// shut down connections
|
||||
foreach (NetConnection conn in list)
|
||||
conn.Shutdown(m_shutdownReason);
|
||||
}
|
||||
}
|
||||
|
||||
lock (m_handshakes)
|
||||
{
|
||||
foreach (var hs in m_handshakes.Values)
|
||||
if (hs != null && list.Contains(hs) == false)
|
||||
list.Add(hs);
|
||||
}
|
||||
|
||||
// shut down connections
|
||||
foreach (NetConnection conn in list)
|
||||
conn.Shutdown(m_shutdownReason);
|
||||
|
||||
FlushDelayedPackets();
|
||||
|
||||
// one final heartbeat, will send stuff and do disconnect
|
||||
|
||||
Reference in New Issue
Block a user