gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37693 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r37693 - gnunet/src/cadet
Date: Wed, 10 Aug 2016 20:04:53 +0200

Author: bartpolot
Date: 2016-08-10 20:04:52 +0200 (Wed, 10 Aug 2016)
New Revision: 37693

Modified:
   gnunet/src/cadet/gnunet-service-cadet_local.c
Log:
- missing implementation

Modified: gnunet/src/cadet/gnunet-service-cadet_local.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_local.c       2016-08-10 18:04:51 UTC 
(rev 37692)
+++ gnunet/src/cadet/gnunet-service-cadet_local.c       2016-08-10 18:04:52 UTC 
(rev 37693)
@@ -379,7 +379,36 @@
 handle_port_close (void *cls, struct GNUNET_SERVER_Client *client,
                    const struct GNUNET_MessageHeader *message)
 {
-       // FIXME
+  struct CadetClient *c;
+  struct GNUNET_CADET_PortMessage *pmsg;
+  int removed;
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "close port requested\n");
+
+  /* Sanity check for client registration */
+  if (NULL == (c = GML_client_get (client)))
+  {
+    GNUNET_break (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  by client %u\n", c->id);
+
+    /* Message size sanity check */
+  if (sizeof (struct GNUNET_CADET_PortMessage) != ntohs (message->size))
+  {
+    GNUNET_break (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
+
+  pmsg = (struct GNUNET_CADET_PortMessage *) message;
+  removed = GNUNET_CONTAINER_multihashmap_remove (c->ports, &pmsg->port, c);
+  GNUNET_break_op (GNUNET_YES == removed);
+  removed = GNUNET_CONTAINER_multihashmap_remove (ports, &pmsg->port, c);
+  GNUNET_break_op (GNUNET_YES == removed);
+
+  GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]