]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
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 3a655ea0aeb7929559535f8d522c1de355172fad..3cb13425b73b45de9011ad46c98553d69c201a00 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 41513ecaa32830c9b751d95e11aa2d850226e7df..de203112b7f004b649f7511776816a889588c348 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 346ebdd41677216c6734e6fe7c6445144435dc26..32c7d61a87df8ebae69b4de4eaa8bb29566946da 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 180bb66c4b298d17493f7f5d96b87004a0d61ccd..5cc6c41abd0756c364b317a54a602aa6c79ad3e7 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 f047ac75caef58cffe6e5071492e25b6036de007..d816a7f3b674c2227f063e23a4088d2907a69ca0 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 2f50f4d1d14dcb3d46d7fe3c7411443123b398f2..de4d467d3a48f54f763b100cb5eeb0a082f7863f 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 61d6f57c95228842180411206ba7123190a585fb..b8247a1932b442921a985c1c6412ef7a7a7f4b8d 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 cac305b8fb36de1acbdb626d5d922a68c779fa32..fcba8db047c28b36e59239c4418328a80168d697 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 39a9d48a6fbce1b5629ee13d870d5303ccd92456..8e68234bdffa27eebfd714d601cfb4193530fade 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