[chocolate-doom] 17/79: Refer to connected clients by their AddrToString() output rather than just the pointer to their struct. Listen for IP connections as well as loopback connections.

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 30 15:07:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.3
in repository chocolate-doom.

commit 33fe9b40bb366a755a3b1ed6fbe9d2c32a815059
Author: Simon Howard <fraggle at gmail.com>
Date:   Mon Jan 2 20:13:06 2006 +0000

    Refer to connected clients by their AddrToString() output rather than just
    the pointer to their struct. Listen for IP connections as well as
    loopback connections.
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 245
---
 src/net_server.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/net_server.c b/src/net_server.c
index f9e12a1..c004e80 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_server.c 243 2006-01-02 17:24:40Z fraggle $
+// $Id: net_server.c 245 2006-01-02 20:13:06Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,11 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.8  2006/01/02 20:13:06  fraggle
+// Refer to connected clients by their AddrToString() output rather than just
+// the pointer to their struct.  Listen for IP connections as well as
+// loopback connections.
+//
 // Revision 1.7  2006/01/02 17:24:40  fraggle
 // Remove test code
 //
@@ -58,6 +63,7 @@
 #include "net_loop.h"
 #include "net_packet.h"
 #include "net_server.h"
+#include "net_sdl.h"
 
 typedef enum 
 {
@@ -97,6 +103,15 @@ static boolean server_initialised = false;
 static net_client_t clients[MAXNETNODES];
 static net_context_t *server_context;
 
+static char *NET_SV_ClientAddress(net_client_t *client)
+{
+    static char addrbuf[128];
+
+    client->addr->module->AddrToString(client->addr, addrbuf, sizeof(addrbuf)-1);
+    
+    return addrbuf;
+}
+
 static void NET_SV_DisconnectClient(net_client_t *client)
 {
     client->state = CLIENT_STATE_DISCONNECTING;
@@ -288,6 +303,8 @@ static void NET_SV_ParseDisconnect(net_packet_t *packet, net_client_t *client)
     // and cleaned up from the clients list.
 
     client->state = CLIENT_STATE_DISCONNECTED;
+
+    //printf("SV: %s: client disconnected\n", NET_SV_ClientAddress(client));
 }
 
 // Parse a DISCONNECT_ACK packet
@@ -334,7 +351,7 @@ static void NET_SV_Packet(net_packet_t *packet, net_addr_t *addr)
         return;
     }
 
-    //printf("SV: %p: %i\n", client, packet_type);
+    //printf("SV: %s: %i\n", NET_SV_ClientAddress(client), packet_type);
 
     switch (packet_type)
     {
@@ -487,7 +504,7 @@ static void NET_SV_RunClient(net_client_t *client)
 
         if (I_GetTimeMS() - client->last_send_time > 5000)
         {
-            //printf("SV: %p: deactivated\n", client);
+            //printf("SV: %s: deactivated\n", NET_SV_ClientAddress(client));
             client->active = false;
             NET_FreeAddress(client->addr);
         }
@@ -505,6 +522,8 @@ void NET_SV_Init(void)
     server_context = NET_NewContext();
     NET_AddModule(server_context, &net_loop_server_module);
     net_loop_server_module.InitServer();
+    NET_AddModule(server_context, &net_sdl_module);
+    net_sdl_module.InitServer();
 
     // no clients yet
    

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git



More information about the Pkg-games-commits mailing list