Delete closed connections when starting a new game or leaving SuperMelee.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2576 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1838,6 +1838,7 @@ DoConfirmSettings (PMELEE_STATE pMS)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#else
|
||||
closeDisconnectedConnections ();
|
||||
netInput ();
|
||||
SleepThread (ONE_SECOND / 120);
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ closeCallback(NetDescriptor *nd) {
|
||||
NetConnection_doClose(conn);
|
||||
}
|
||||
|
||||
// Close and release a NetDescriptor.
|
||||
// Close and release a NetConnection.
|
||||
void
|
||||
NetConnection_close(NetConnection *conn) {
|
||||
if (conn->nd != NULL) {
|
||||
@@ -176,6 +176,7 @@ NetConnection_close(NetConnection *conn) {
|
||||
// This would queue the close callback.
|
||||
conn->nd = NULL;
|
||||
}
|
||||
if (!conn->stateFlags.disconnected)
|
||||
NetConnection_doClose(conn);
|
||||
NetConnection_delete(conn);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,20 @@ closeAllConnections(void) {
|
||||
{
|
||||
NetConnection *conn = netConnections[player];
|
||||
|
||||
if (conn != NULL && NetConnection_isConnected(conn))
|
||||
if (conn != NULL)
|
||||
closePlayerNetworkConnection(player);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
closeDisconnectedConnections(void) {
|
||||
COUNT player;
|
||||
|
||||
for (player = 0; player < NUM_PLAYERS; player++)
|
||||
{
|
||||
NetConnection *conn = netConnections[player];
|
||||
|
||||
if (conn != NULL && !NetConnection_isConnected(conn))
|
||||
closePlayerNetworkConnection(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ extern struct NetConnection *netConnections[];
|
||||
void addNetConnection(NetConnection *conn, int playerNr);
|
||||
void removeNetConnection(int playerNr);
|
||||
void closeAllConnections(void);
|
||||
void closeAllConnections(void);
|
||||
void closeDisconnectedConnections(void);
|
||||
size_t getNumNetConnections(void);
|
||||
|
||||
struct melee_state *NetMelee_getMeleeState(NetConnection *conn);
|
||||
|
||||
Reference in New Issue
Block a user