Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix server resource leaks during client reconnect #281

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions code/server/sv_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,15 @@ void SV_DirectConnect( const netadr_t *from ) {
Com_Printf( "%s:reconnect\n", NET_AdrToString( from ) );
newcl = cl;

// this doesn't work because it nukes the players userinfo
if ( newcl->state >= CS_CONNECTED ) {
// call QVM disconnect function before calling connect again
// fixes issues such as disappearing CTF flags in unpatched mods
VM_Call( gvm, 1, GAME_CLIENT_DISCONNECT, newcl - svs.clients );

// don't leak memory or file handles due to e.g. downloads in progress
SV_FreeClient( newcl );
}

// // disconnect the client from the game first so any flags the
// // player might have are dropped
// VM_Call( gvm, GAME_CLIENT_DISCONNECT, 1, newcl - svs.clients );
//
goto gotnewcl;
}
}
Expand Down
Loading