From 3ebbcc7c1456d3848aa496d0173f1ff9f796c86a Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 28 Mar 2003 13:24:11 +0000 Subject: [PATCH] changed behavior of SV_DropClient a bit (now calls ClientDisconnect QC function even if crash is true, as it's the client being harshly dropped, not the server dying), and made the final svc_disconnect an unreliable message git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2869 d7cf8633-e32d-0410-b094-e92efae38249 --- host.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/host.c b/host.c index 465545ad..7b24461b 100644 --- a/host.c +++ b/host.c @@ -428,25 +428,31 @@ void SV_DropClient (qboolean crash) if (!crash) { // send any final messages (don't check for errors) +#if 1 + // LordHavoc: no opportunity for resending, so reliable is silly + MSG_WriteByte (&host_client->message, svc_disconnect); + NET_SendUnreliableMessage (host_client->netconnection, &host_client->message); +#else if (NET_CanSendMessage (host_client->netconnection)) { MSG_WriteByte (&host_client->message, svc_disconnect); NET_SendMessage (host_client->netconnection, &host_client->message); } +#endif + } - if (sv.active && host_client->edict && host_client->spawned) // LordHavoc: don't call QC if server is dead (avoids recursive Host_Error in some mods when they run out of edicts) - { - // call the prog function for removing a client - // this will set the body to a dead frame, among other things - saveSelf = pr_global_struct->self; - pr_global_struct->self = EDICT_TO_PROG(host_client->edict); - PR_ExecuteProgram (pr_global_struct->ClientDisconnect, "QC function ClientDisconnect is missing"); - pr_global_struct->self = saveSelf; - } - - Sys_Printf ("Client %s removed\n",host_client->name); + if (sv.active && host_client->edict && host_client->spawned) // LordHavoc: don't call QC if server is dead (avoids recursive Host_Error in some mods when they run out of edicts) + { + // call the prog function for removing a client + // this will set the body to a dead frame, among other things + saveSelf = pr_global_struct->self; + pr_global_struct->self = EDICT_TO_PROG(host_client->edict); + PR_ExecuteProgram (pr_global_struct->ClientDisconnect, "QC function ClientDisconnect is missing"); + pr_global_struct->self = saveSelf; } + Sys_Printf ("Client %s removed\n",host_client->name); + // break the net connection NET_Close (host_client->netconnection); host_client->netconnection = NULL; -- 2.39.2