-static char *trustDirectory;
-
-
-/**
- * Transmit peer information messages from the pending queue
- * to the client.
- *
- * @param cls the 'struct NotifyList' that we are processing
- * @param size number of bytes we can transmit
- * @param vbuf where to write the messages
- * @return number of bytes written to vbuf
- */
-static size_t
-transmit_pending_notification (void *cls,
- size_t size,
- void *vbuf)
-{
- struct NotifyList *nl = cls;
- char *buf = vbuf;
- struct PendingEntry *pos;
- struct PendingEntry *next;
- struct InfoMessage im;
- uint16_t hs;
- size_t left;
-
- nl->transmit_ctx = NULL;
- next = nl->pending;
- pos = nl->pending;
- left = size;
- while (pos != NULL)
- {
- hs = (pos->he->hello == NULL) ? 0 : GNUNET_HELLO_size (pos->he->hello);
- if (left < sizeof (struct InfoMessage) + hs)
- break;
- next = pos->next;
- im.header.size = htons (hs + sizeof (struct InfoMessage));
- im.header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
- im.trust = htonl (pos->he->trust);
- im.peer = pos->he->identity;
- memcpy (&buf[size - left], &im, sizeof (struct InfoMessage));
- memcpy (&buf[size - left + sizeof (struct InfoMessage)], pos->he->hello, hs);
- left -= hs + sizeof (struct InfoMessage);
- GNUNET_free (pos);
- pos = next;
- }
- nl->pending = next;
- if (nl->pending != NULL)
- {
- nl->transmit_ctx
- = GNUNET_SERVER_notify_transmit_ready (nl->client,
- sizeof (struct InfoMessage) + hs,
- GNUNET_TIME_UNIT_FOREVER_REL,
- &transmit_pending_notification,
- nl);
- }
- return size - left;
-}
-
-
-
-/**
- * Notify client about host change. Checks if the
- * respective host entry is already in the list of things
- * to send to the client, and if not, adds it. Also
- * triggers a new request for transmission if the pending
- * list was previously empty.
- *
- * @param nl client to notify
- * @param hc entry to notify about
- */
-static void
-do_notify (struct NotifyList *nl,
- struct HostEntry *he)
-{
- struct PendingEntry *pe;
- uint16_t hsize;
-
- pe = nl->pending;
- while (NULL != pe)
- {
- if (pe->he == he)
- return; /* already in list */
- pe = pe->next;
- }
- pe = GNUNET_malloc (sizeof (struct PendingEntry));
- pe->next = nl->pending;
- pe->he = he;
- nl->pending = pe;
- if (nl->transmit_ctx != NULL)
- return; /* already trying to transmit */
- hsize = (he->hello == NULL) ? 0 : GNUNET_HELLO_size (he->hello);
- nl->transmit_ctx = GNUNET_SERVER_notify_transmit_ready (nl->client,
- sizeof (struct InfoMessage) + hsize,
- GNUNET_TIME_UNIT_FOREVER_REL,
- &transmit_pending_notification,
- nl);
-}