{
struct GNUNET_SERVICE_Client *client = listener->client;
+ GNUNET_MQ_destroy (listener->client_mq);
+ listener->client_mq = NULL;
+
listener->client = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Disconnecting listener client\n");
}
-/**
- * Clean up after a client has disconnected
- *
- * @param cls closure, unused
- * @param client the client to clean up after
- * @param internal_cls our client-specific internal data structure
- */
-static void
-client_disconnect_cb (void *cls,
- struct GNUNET_SERVICE_Client *client,
- void *internal_cls)
-{
- struct Listener *listener;
- struct Set *set;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "client disconnected, cleaning up\n");
- set = set_get (client);
- if (NULL != set)
- {
- set->client = NULL;
- set_destroy (set);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Client's set destroyed\n");
- }
- listener = listener_get (client);
- if (NULL != listener)
- {
- listener->client = NULL;
- listener_destroy (listener);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Client's listener destroyed\n");
- }
-}
-
-
/**
* Destroy an incoming request from a remote peer
*
}
+/**
+ * Clean up after a client has disconnected
+ *
+ * @param cls closure, unused
+ * @param client the client to clean up after
+ * @param internal_cls our client-specific internal data structure
+ */
+static void
+client_disconnect_cb (void *cls,
+ struct GNUNET_SERVICE_Client *client,
+ void *internal_cls)
+{
+ struct Set *set;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "client disconnected, cleaning up\n");
+ set = set_get (client);
+ if (NULL != set)
+ {
+ set->client = NULL;
+ set_destroy (set);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client's set destroyed\n");
+ }
+ struct Listener *listener = listener_get (client);
+ struct Operation *op = incoming_head;
+ if (NULL != listener)
+ {
+ /* destroy all incoming operations whose client just
+ * got destroyed */
+ while (NULL != op)
+ {
+ struct Operation *curr = op;
+ op = op->next;
+ if ( (GNUNET_YES == curr->is_incoming) &&
+ (curr->listener == listener) )
+ incoming_destroy (curr);
+ }
+ listener->client = NULL;
+ listener_destroy (listener);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Client's listener destroyed\n");
+ }
+}
+
+
/**
* Suggest the given request to the listener. The listening client can
* then accept or reject the remote request.
listener = op->listener;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received P2P operation request (op %u, port %s) for active listener\n",
- ntohl (msg->operation),
+ (uint32_t) ntohl (msg->operation),
GNUNET_h2s (&listener->app_id));
incoming_suggest (op,
listener);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client created new set (operation %u)\n",
- ntohl (msg->operation));
+ (uint32_t) ntohl (msg->operation));
if (NULL != set_get (client))
{
/* There can only be one set per client */
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE,
struct GNUNET_MessageHeader,
NULL),
+ GNUNET_MQ_hd_var_size (p2p_message,
+ GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL,
+ struct GNUNET_MessageHeader,
+ NULL),
GNUNET_MQ_hd_var_size (p2p_message,
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE,
struct GNUNET_MessageHeader,
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE,
struct GNUNET_MessageHeader,
op),
+ GNUNET_MQ_hd_var_size (p2p_message,
+ GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL,
+ struct GNUNET_MessageHeader,
+ op),
GNUNET_MQ_hd_var_size (p2p_message,
GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT,
struct GNUNET_MessageHeader,
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client requested cancel for op %u\n",
- ntohl (msg->request_id));
+ (uint32_t) ntohl (msg->request_id));
found = GNUNET_NO;
for (op = set->ops_head; NULL != op; op = op->next)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client accepting request %u\n",
- ntohl (msg->accept_reject_id));
+ (uint32_t) ntohl (msg->accept_reject_id));
GNUNET_assert (GNUNET_YES == op->is_incoming);
op->is_incoming = GNUNET_NO;
GNUNET_CONTAINER_DLL_remove (incoming_head,