tUpdate GUI server to use GIOChannel - vaccinewars - be a doctor and try to vaccinate the world
git clone git://src.adamsgaard.dk/vaccinewars
Log
Files
Refs
README
LICENSE
---
commit 5eeac88eb4ff395e7833d01fa06c7b050e911295
parent 5c1fe80892ec0d15f17b0b9f3953902ce667da13
Author: Ben Webb 
Date:   Thu, 19 Nov 2020 18:51:24 -0800

Update GUI server to use GIOChannel

Fix callbacks used by GUI server to use
tthe new GIOChannel code, rather than the old
GdkInputCondition.

Diffstat:
  M src/serverside.c                    |      17 +++++++++--------

1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/serverside.c b/src/serverside.c
t@@ -1448,8 +1448,8 @@ static void GuiDoCommand(GtkWidget *widget, gpointer data)
     GuiQuitServer();
 }
 
-static void GuiHandleSocket(gpointer data, gint socket,
-                            GdkInputCondition condition)
+static gboolean GuiHandleSocket(GIOChannel *source, GIOCondition condition,
+                                gpointer data)
 {
   Player *Play;
   gboolean DoneOK;
t@@ -1458,11 +1458,10 @@ static void GuiHandleSocket(gpointer data, gint socket,
 
   /* Sanity check - is the player still around? */
   if (!g_slist_find(FirstServer, (gpointer)Play))
-    return;
+    return TRUE;
 
-  if (PlayerHandleNetwork(Play, condition & GDK_INPUT_READ,
-                          condition & GDK_INPUT_WRITE,
-                          condition & GDK_INPUT_EXCEPTION, &DoneOK)) {
+  if (PlayerHandleNetwork(Play, condition & G_IO_IN, condition & G_IO_OUT,
+                          condition & G_IO_ERR, &DoneOK)) {
     HandleServerPlayer(Play);
     GuiSetTimeouts();           /* We may have set some new timeouts */
   }
t@@ -1471,6 +1470,7 @@ static void GuiHandleSocket(gpointer data, gint socket,
     if (IsServerShutdown())
       GuiQuitServer();
   }
+  return TRUE;
 }
 
 void SocketStatus(NetworkBuffer *NetBuf, gboolean Read, gboolean Write,
t@@ -1491,8 +1491,8 @@ void SocketStatus(NetworkBuffer *NetBuf, gboolean Read, gboolean Write,
     GuiHandleSocket(NetBuf->ioch, 0, NetBuf->CallBackData);
 }
 
-static void GuiNewConnect(GIOChannel *source, GIOCondition condition,
-                          gpointer data)
+static gboolean GuiNewConnect(GIOChannel *source, GIOCondition condition,
+                              gpointer data)
 {
   Player *Play;
 
t@@ -1500,6 +1500,7 @@ static void GuiNewConnect(GIOChannel *source, GIOCondition condition,
     Play = HandleNewConnection();
     SetNetworkBufferCallBack(&Play->NetBuf, SocketStatus, (gpointer)Play);
   }
+  return TRUE;
 }
 
 static gboolean TriedPoliteShutdown = FALSE;