Skip to content

Commit

Permalink
Merge pull request #281 from Chomenor/reconnect_fix
Browse files Browse the repository at this point in the history
Fix server resource leaks during client reconnect
  • Loading branch information
ec- authored May 23, 2024
2 parents e7884db + 63bdea7 commit 2baff41
Showing 1 changed file with 8 additions and 5 deletions.
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

0 comments on commit 2baff41

Please sign in to comment.