+ pmsg = (struct GNUNET_CADET_PortMessage *) message;
+ if (NULL == c->ports)
+ {
+ c->ports = GNUNET_CONTAINER_multihashmap_create (4, GNUNET_NO);
+ }
+ /* store in client's hashmap */
+ if (GNUNET_OK !=
+ GNUNET_CONTAINER_multihashmap_put (c->ports, &pmsg->port, c,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
+ {
+ GNUNET_break (0);
+ GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ return;
+ }
+ /* store in global hashmap */
+ /* FIXME only allow one client to have the port open,
+ * have a backup hashmap with waiting clients */
+ GNUNET_CONTAINER_multihashmap_put (ports, &pmsg->port, c,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
+}
+
+
+/**
+ * Handler for port close requests.
+ *
+ * @param cls Closure.
+ * @param client Identification of the client.
+ * @param message The actual message.
+ */
+static void
+handle_port_close (void *cls, struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
+{
+ 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)))