From 01ee1d8d3285a79f3e3d92974c267c72f6f938c3 Mon Sep 17 00:00:00 2001 From: qbism Date: Sat, 2 Apr 2016 16:06:17 -0400 Subject: [PATCH] Dedicated reconnect fixed based on simple test. --- host_cmd.c | 25 ++++++++++++------------- net_dgrm.c | 6 +++--- net_main.c | 6 ++++++ sv_main.c | 7 ++++++- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/host_cmd.c b/host_cmd.c index f9f5ee2..241be60 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -35,19 +35,18 @@ Host_Quit_f ================== */ -extern void M_Quit_f (void); - -void Host_Quit_f (void) //qb: restored original function -{ - if (key_dest != key_console && cls.state != ca_dedicated) - { - M_Quit_f (); - return; - } - CL_Disconnect (); - Host_ShutdownServer(false); - - Sys_Quit (); +void Host_Quit_f (void) +{ + /* // Manoel Kasimier - "quit" always quits - removed - begin + if (key_dest != key_console && cls.state != ca_dedicated) + { + M_Menu_Quit_f (); + return; + } + */ // Manoel Kasimier - "quit" always quits - removed - end CL_Disconnect (); + Host_ShutdownServer(false); + + Sys_Quit (); } diff --git a/net_dgrm.c b/net_dgrm.c index 1ea7647..56b29c5 100644 --- a/net_dgrm.c +++ b/net_dgrm.c @@ -1036,9 +1036,9 @@ static qsocket_t *_Datagram_CheckNewConnections (void) //qb: from bjpquake // it's somebody coming back in from a crash/disconnect // so close the old qsocket and let their retry get them back in - // ProQuake fix -// NET_Close(s); -// return NULL; + //qb: ProQuake fix commented these out, but otherwise can't reconnect on LAN + NET_Close(s); + return NULL; } } diff --git a/net_main.c b/net_main.c index 7bbc094..9eda97d 100644 --- a/net_main.c +++ b/net_main.c @@ -628,6 +628,11 @@ qboolean NET_CanSendMessage (qsocket_t *sock) int NET_SendToAll(sizebuf_t *data, int blocktime) +{ + return NET_SendToAll2 (data, blocktime, false); +} + +int NET_SendToAll2 (sizebuf_t *data, int blocktime, qboolean nolocals) { double start; int i; @@ -643,6 +648,7 @@ int NET_SendToAll(sizebuf_t *data, int blocktime) { if (host_client->netconnection->driver == 0) { + if (!nolocals) NET_SendMessage(host_client->netconnection, data); state1[i] = true; state2[i] = true; diff --git a/sv_main.c b/sv_main.c index 4a30751..6a1bf63 100644 --- a/sv_main.c +++ b/sv_main.c @@ -1505,7 +1505,12 @@ void SV_SendReconnect (void) MSG_WriteByte (&msg, svc_stufftext); MSG_WriteString (&msg, "reconnect\n"); - NET_SendToAll (&msg, 5); + + // Don't send a reconnect message to a local client; it can cause problems if coming + // after the client has already reached signon 4. In that case, the client will behave + // as if reconnect is entered in the console while playing; the loading plaque will + // display and the client is detached from the game (which will continue) + NET_SendToAll2 (&msg, 5, true); if (cls.state != ca_dedicated)