};
+/**
+ * Client has disconnected, clean up.
+ *
+ * @param cls our 'struct GNUNET_SERVER_NotificationContext *'
+ * @param client handle of client that disconnected
+ */
static void
handle_client_disconnect (void *cls,
struct GNUNET_SERVER_Client *client)
struct ClientList *prev;
struct PendingMessageList *pml;
+ if (client == NULL)
+ {
+ nc->server = NULL;
+ return;
+ }
prev = NULL;
pos = nc->clients;
while (NULL != pos)
GNUNET_free (pml);
}
GNUNET_SERVER_client_drop (client);
+ if (pos->th != NULL)
+ {
+ GNUNET_CONNECTION_notify_transmit_ready_cancel (pos->th);
+ pos->th = NULL;
+ }
GNUNET_free (pos);
}
while (NULL != (pos = nc->clients))
{
nc->clients = pos->next;
- GNUNET_SERVER_receive_done (pos->client, GNUNET_NO);
GNUNET_SERVER_client_drop (pos->client);
+ GNUNET_SERVER_receive_done (pos->client, GNUNET_NO);
while (NULL != (pml = pos->pending_head))
{
pos->pending_head = pml->next;
}
GNUNET_free (pos);
}
- GNUNET_SERVER_disconnect_notify_cancel (nc->server,
- &handle_client_disconnect,
- nc);
+ if (nc->server != NULL)
+ GNUNET_SERVER_disconnect_notify_cancel (nc->server,
+ &handle_client_disconnect,
+ nc);
GNUNET_free (nc);
}