Skip to content

Commit 3f2cc6e

Browse files
committed
Clear the poll list and mark it as needing rebuild in a few key places
This is in case the library is shutdown and re-initialized. I believe this fixes #230. P4: 7317139
1 parent 0d45cff commit 3f2cc6e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_lowlevel.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,6 +3272,11 @@ bool BSteamNetworkingSocketsLowLevelAddRef( SteamNetworkingErrMsg &errMsg )
32723272
}
32733273
#endif
32743274

3275+
// Make sure poll list is recreated upon first use
3276+
#ifdef USE_POLL
3277+
s_bRecreatePollList = true;
3278+
#endif
3279+
32753280
SpewMsg( "Initialized low level socket/threading support.\n" );
32763281
}
32773282

@@ -3375,6 +3380,14 @@ void SteamNetworkingSocketsLowLevelDecRef()
33753380
AssertMsg( false, "Trying to close low level socket support, but we still have sockets open!" );
33763381
}
33773382

3383+
// Free any memory in poll list (the only thing that could be left is the read side of
3384+
// a socket pair used to wake the thread, which we just deleted). And make sure we rebuild
3385+
// the list for first use if the library is re-initialized
3386+
#ifdef USE_POLL
3387+
s_vecPollFDs.Purge();
3388+
s_bRecreatePollList = true;
3389+
#endif
3390+
33783391
// Nuke packet lagger queues and make sure we are not registered to think
33793392
s_packetLagQueueRecv.Clear();
33803393
s_packetLagQueueSend.Clear();

0 commit comments

Comments
 (0)