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 FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
#else
|
||||||
|
closeDisconnectedConnections ();
|
||||||
netInput ();
|
netInput ();
|
||||||
SleepThread (ONE_SECOND / 120);
|
SleepThread (ONE_SECOND / 120);
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ closeCallback(NetDescriptor *nd) {
|
|||||||
NetConnection_doClose(conn);
|
NetConnection_doClose(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close and release a NetDescriptor.
|
// Close and release a NetConnection.
|
||||||
void
|
void
|
||||||
NetConnection_close(NetConnection *conn) {
|
NetConnection_close(NetConnection *conn) {
|
||||||
if (conn->nd != NULL) {
|
if (conn->nd != NULL) {
|
||||||
@@ -176,7 +176,8 @@ NetConnection_close(NetConnection *conn) {
|
|||||||
// This would queue the close callback.
|
// This would queue the close callback.
|
||||||
conn->nd = NULL;
|
conn->nd = NULL;
|
||||||
}
|
}
|
||||||
NetConnection_doClose(conn);
|
if (!conn->stateFlags.disconnected)
|
||||||
|
NetConnection_doClose(conn);
|
||||||
NetConnection_delete(conn);
|
NetConnection_delete(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,20 @@ closeAllConnections(void) {
|
|||||||
{
|
{
|
||||||
NetConnection *conn = netConnections[player];
|
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);
|
closePlayerNetworkConnection(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ extern struct NetConnection *netConnections[];
|
|||||||
void addNetConnection(NetConnection *conn, int playerNr);
|
void addNetConnection(NetConnection *conn, int playerNr);
|
||||||
void removeNetConnection(int playerNr);
|
void removeNetConnection(int playerNr);
|
||||||
void closeAllConnections(void);
|
void closeAllConnections(void);
|
||||||
void closeAllConnections(void);
|
void closeDisconnectedConnections(void);
|
||||||
size_t getNumNetConnections(void);
|
size_t getNumNetConnections(void);
|
||||||
|
|
||||||
struct melee_state *NetMelee_getMeleeState(NetConnection *conn);
|
struct melee_state *NetMelee_getMeleeState(NetConnection *conn);
|
||||||
|
|||||||
Reference in New Issue
Block a user