Do more Discord API cleanup on network shutdown

This commit is contained in:
MysterD 2022-05-11 01:33:56 -07:00
parent 91988cc426
commit 2c9f42abd6
3 changed files with 10 additions and 1 deletions

View File

@ -76,8 +76,9 @@ void discord_network_init(int64_t lobbyId) {
}
void discord_network_shutdown(void) {
app.lobbies->flush_network(app.lobbies);
if (gCurLobbyId == 0) { return; }
app.lobbies->flush_network(app.lobbies);
app.lobbies->disconnect_network(app.lobbies, gCurLobbyId);
app.lobbies->flush_network(app.lobbies);
LOGFILE_INFO(LFT_DISCORD, "shutdown network, lobby = " DISCORD_ID_FORMAT, gCurLobbyId);
}

View File

@ -115,6 +115,13 @@ void discord_lobby_leave(void) {
LOGFILE_INFO(LFT_DISCORD, "left lobby " DISCORD_ID_FORMAT, gCurLobbyId);
if (snprintf(gCurActivity.party.id, 128, "%s", "none") < 0) {
LOGFILE_ERROR(LFT_DISCORD, "Truncating party id");
}
gCurActivity.party.size.current_size = 1;
gCurActivity.party.size.max_size = 1;
discord_activity_update(gNetworkType == NT_SERVER);
isHosting = false;
gCurLobbyId = 0;
}

View File

@ -77,6 +77,7 @@ bool network_init(enum NetworkType inNetworkType) {
return false;
}
network_forget_all_reliable();
crash_handler_init();
// set server settings