removed crash parameter from Host_ShudownServer, eliminated NetConn_SendToAll and...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 11 Feb 2006 04:24:19 +0000 (04:24 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 11 Feb 2006 04:24:19 +0000 (04:24 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5962 d7cf8633-e32d-0410-b094-e92efae38249

cl_demo.c
cl_input.c
cl_main.c
host.c
host_cmd.c
netconn.c
netconn.h
quakedef.h
sv_main.c

index 3a655ea..3cb1342 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -328,7 +328,7 @@ void CL_PlayDemo_f (void)
 
        // disconnect from server
        CL_Disconnect ();
-       Host_ShutdownServer (false);
+       Host_ShutdownServer ();
 
        // update networking ports (this is mainly just needed at startup)
        NetConn_ClientFrame();
index 41513ec..de20311 100644 (file)
@@ -1009,7 +1009,7 @@ void CL_SendMove(void)
        {
                Con_Print("CL_SendMove: lost server connection\n");
                CL_Disconnect();
-               Host_ShutdownServer(false);
+               Host_ShutdownServer();
        }
 }
 
index 346ebdd..32c7d61 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -328,7 +328,7 @@ void CL_Disconnect_f(void)
 {
        CL_Disconnect ();
        if (sv.active)
-               Host_ShutdownServer (false);
+               Host_ShutdownServer ();
 }
 
 
diff --git a/host.c b/host.c
index 180bb66..5cc6c41 100644 (file)
--- a/host.c
+++ b/host.c
@@ -147,7 +147,7 @@ void Host_Error (const char *error, ...)
        PRVM_Crash();
 
 
-       Host_ShutdownServer (false);
+       Host_ShutdownServer ();
 
        if (cls.state == ca_dedicated)
                Sys_Error ("Host_Error: %s",hosterrorstring2);  // dedicated servers exit
@@ -489,11 +489,9 @@ Host_ShutdownServer
 This only happens at the end of a game, not between levels
 ==================
 */
-void Host_ShutdownServer(qboolean crash)
+void Host_ShutdownServer(void)
 {
-       int i, count;
-       sizebuf_t buf;
-       unsigned char message[4];
+       int i;
 
        Con_DPrintf("Host_ShutdownServer\n");
 
@@ -504,18 +502,10 @@ void Host_ShutdownServer(qboolean crash)
        NetConn_Heartbeat(2);
 
 // make sure all the clients know we're disconnecting
-       buf.data = message;
-       buf.maxsize = 4;
-       buf.cursize = 0;
-       MSG_WriteByte(&buf, svc_disconnect);
-       count = NetConn_SendToAll(&buf, 5);
-       if (count)
-               Con_Printf("Host_ShutdownServer: NetConn_SendToAll failed for %u clients\n", count);
-
        SV_VM_Begin();
        for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
                if (host_client->active)
-                       SV_DropClient(crash); // server shutdown
+                       SV_DropClient(false); // server shutdown
        SV_VM_End();
 
        NetConn_CloseServerPorts();
@@ -1121,7 +1111,7 @@ void Host_Shutdown(void)
        CL_Disconnect();
 
        // shut down local server if active
-       Host_ShutdownServer (false);
+       Host_ShutdownServer ();
 
        // Shutdown menu
        if(MR_Shutdown)
index f047ac7..d816a7f 100644 (file)
@@ -267,7 +267,7 @@ void Host_Map_f (void)
        cls.demonum = -1;               // stop demo loop in case this fails
 
        CL_Disconnect ();
-       Host_ShutdownServer(false);
+       Host_ShutdownServer();
 
        // remove console or menu
        key_dest = key_game;
@@ -1901,7 +1901,7 @@ void Host_Stopdemo_f (void)
        if (!cls.demoplayback)
                return;
        CL_Disconnect ();
-       Host_ShutdownServer (false);
+       Host_ShutdownServer ();
 }
 
 void Host_SendCvar_f (void)
index 2f50f4d..de4d467 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -933,7 +933,7 @@ void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_t *peer
        CL_Disconnect();
        // if we're connecting to a remote server, shut down any local server
        if (LHNETADDRESS_GetAddressType(peeraddress) != LHNETADDRESSTYPE_LOOP && sv.active)
-               Host_ShutdownServer (false);
+               Host_ShutdownServer ();
        // allocate a net connection to keep track of things
        cls.netcon = NetConn_Open(mysocket, peeraddress);
        Con_Printf("Connection accepted to %s\n", cls.netcon->address);
@@ -1327,7 +1327,7 @@ void NetConn_ClientFrame(void)
        {
                Con_Print("Connection timed out\n");
                CL_Disconnect();
-               Host_ShutdownServer (false);
+               Host_ShutdownServer ();
        }
        for (conn = netconn_list;conn;conn = conn->next)
                NetConn_ReSendMessage(conn);
@@ -1932,43 +1932,6 @@ void NetConn_Heartbeat(int priority)
        }
 }
 
-int NetConn_SendToAll(sizebuf_t *data, double blocktime)
-{
-       int i, count = 0;
-       unsigned char sent[MAX_SCOREBOARD];
-
-       memset(sent, 0, sizeof(sent));
-
-       // simultaneously wait for the first CanSendMessage and send the message,
-       // then wait for a second CanSendMessage (verifying it was received), or
-       // the client drops and is no longer counted
-       // the loop aborts when either it runs out of clients to send to, or a
-       // timeout expires
-       blocktime += Sys_DoubleTime();
-       do
-       {
-               count = 0;
-               // run a network frame to check for packets
-               NetConn_ClientFrame();SV_VM_Begin();NetConn_ServerFrame();SV_VM_End();
-               for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
-               {
-                       if (host_client->netconnection)
-                       {
-                               if (NetConn_CanSendMessage(host_client->netconnection))
-                               {
-                                       if (!sent[i])
-                                               NetConn_SendReliableMessage(host_client->netconnection, data);
-                                       sent[i] = true;
-                               }
-                               if (!NetConn_CanSendMessage(host_client->netconnection))
-                                       count++;
-                       }
-               }
-       }
-       while (count && Sys_DoubleTime() < blocktime);
-       return count;
-}
-
 static void Net_Heartbeat_f(void)
 {
        if (sv.active)
index 61d6f57..b8247a1 100755 (executable)
--- a/netconn.h
+++ b/netconn.h
@@ -317,7 +317,6 @@ void NetConn_ServerFrame(void);
 void NetConn_QueryMasters(void);
 void NetConn_Heartbeat(int priority);
 void NetConn_QueryQueueFrame(void);
-int NetConn_SendToAll(sizebuf_t *data, double blocktime);
 void Net_Stats_f(void);
 void Net_Slist_f(void);
 
index cac305b..fcba8db 100644 (file)
@@ -241,7 +241,7 @@ void Host_Error(const char *error, ...);
 void Host_Frame(float time);
 void Host_Quit_f(void);
 void Host_ClientCommands(const char *fmt, ...);
-void Host_ShutdownServer(qboolean crash);
+void Host_ShutdownServer(void);
 void Host_Reconnect_f(void);
 
 void Host_AbortCurrentFrame(void);
index 39a9d48..8e68234 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -1606,36 +1606,6 @@ void SV_CreateBaseline (void)
 }
 
 
-/*
-================
-SV_SendReconnect
-
-Tell all the clients that the server is changing levels
-================
-*/
-void SV_SendReconnect (void)
-{
-#if 1
-       MSG_WriteByte(&sv.reliable_datagram, svc_stufftext);
-       MSG_WriteString(&sv.reliable_datagram, "reconnect\n");
-#else
-       unsigned char data[128];
-       sizebuf_t msg;
-
-       msg.data = data;
-       msg.cursize = 0;
-       msg.maxsize = sizeof(data);
-
-       MSG_WriteChar (&msg, svc_stufftext);
-       MSG_WriteString (&msg, "reconnect\n");
-       NetConn_SendToAll (&msg, 5);
-
-       if (cls.state != ca_dedicated)
-               Cmd_ExecuteString ("reconnect\n", src_command);
-#endif
-}
-
-
 /*
 ================
 SV_SaveSpawnparms
@@ -1748,8 +1718,10 @@ void SV_SpawnServer (const char *server)
 //
        if (sv.active)
        {
+               // Tell all the clients that the server is changing levels
                SV_VM_Begin();
-               SV_SendReconnect();
+               MSG_WriteByte(&sv.reliable_datagram, svc_stufftext);
+               MSG_WriteString(&sv.reliable_datagram, "reconnect\n");
                SV_VM_End();
        }
        else