if ( (0 != (options & GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND)) &&
(0 != (c->options & GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND)) )
continue;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending %u message with %u bytes to client interested in messages of type %u.\n",
options,
ntohs (msg->size),
c->options = ntohl (im->options);
all_client_options |= c->options;
c->types = (const uint16_t *) &c[1];
- c->connectmap = GNUNET_CONTAINER_multihashmap_create (16);
+ c->connectmap = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO);
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (c->connectmap,
&GSC_my_identity.hashPubKey,
return;
}
if (c->requests == NULL)
- c->requests = GNUNET_CONTAINER_multihashmap_create (16);
+ c->requests = GNUNET_CONTAINER_multihashmap_create (16, GNUNET_NO);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client asked for transmission to `%s'\n",
GNUNET_i2s (&req->peer));
* @param client reservation request ('struct GSC_ClientActiveRequest')
* @param message the actual message
*/
-static void
+static int
client_tokenizer_callback (void *cls, void *client,
const struct GNUNET_MessageHeader *message)
{
struct TokenizerContext *tc = client;
struct GSC_ClientActiveRequest *car = tc->car;
+ char buf[92];
+ GNUNET_snprintf (buf, sizeof (buf),
+ gettext_noop ("# bytes of messages of type %u received"),
+ (unsigned int) ntohs (message->type));
+ GNUNET_STATISTICS_update (GSC_stats, buf, ntohs (message->size), GNUNET_NO);
if (0 ==
memcmp (&car->target, &GSC_my_identity,
sizeof (struct GNUNET_PeerIdentity)))
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Delivering message of type %u to myself\n",
ntohs (message->type));
- GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+ GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
ntohs (message->size),
GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND);
- GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+ GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
sizeof (struct GNUNET_MessageHeader),
GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND);
- GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+ GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
ntohs (message->size),
GNUNET_CORE_OPTION_SEND_FULL_INBOUND);
- GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message,
+ GSC_CLIENTS_deliver_message (&GSC_my_identity, message,
sizeof (struct GNUNET_MessageHeader),
GNUNET_CORE_OPTION_SEND_HDR_INBOUND);
}
else
{
-#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Delivering message of type %u to %s\n", ntohs (message->type),
GNUNET_i2s (&car->target));
-#endif
- GSC_CLIENTS_deliver_message (&car->target, NULL, 0, message,
+ GSC_CLIENTS_deliver_message (&car->target, message,
ntohs (message->size),
GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND);
- GSC_CLIENTS_deliver_message (&car->target, NULL, 0, message,
+ GSC_CLIENTS_deliver_message (&car->target, message,
sizeof (struct GNUNET_MessageHeader),
GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND);
GSC_SESSIONS_transmit (car, message, tc->cork);
}
+ return GNUNET_OK;
}
* @return GNUNET_YES (continue iteration)
*/
static int
-destroy_active_client_request (void *cls, const GNUNET_HashCode * key,
+destroy_active_client_request (void *cls, const struct GNUNET_HashCode * key,
void *value)
{
struct GSC_ClientActiveRequest *car = value;
if (client == NULL)
return;
-#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Client %p has disconnected from core service.\n", client);
-#endif
c = find_client (client);
if (c == NULL)
return; /* client never sent INIT */
*
* @param client client to notify
* @param neighbour identity of the neighbour that changed status
- * @param atsi performance information about neighbour
- * @param atsi_count number of entries in 'ats' array
* @param tmap_old previous type map for the neighbour, NULL for disconnect
* @param tmap_new updated type map for the neighbour, NULL for disconnect
*/
GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
const struct GNUNET_PeerIdentity
*neighbour,
- const struct GNUNET_ATS_Information
- *atsi, unsigned int atsi_count,
const struct GSC_TypeMap *tmap_old,
const struct GSC_TypeMap *tmap_new)
{
struct ConnectNotifyMessage *cnm;
size_t size;
char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN;
- struct GNUNET_ATS_Information *a;
struct DisconnectNotifyMessage dcm;
int old_match;
int new_match;
&neighbour->hashPubKey,
NULL,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
- size =
- sizeof (struct ConnectNotifyMessage) +
- (atsi_count) * sizeof (struct GNUNET_ATS_Information);
- if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
- {
- GNUNET_break (0);
- /* recovery strategy: throw away performance data */
- atsi_count = 0;
- size = sizeof (struct ConnectNotifyMessage);
- }
+ size = sizeof (struct ConnectNotifyMessage);
cnm = (struct ConnectNotifyMessage *) buf;
cnm->header.size = htons (size);
cnm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
- cnm->ats_count = htonl (atsi_count);
- a = (struct GNUNET_ATS_Information *) &cnm[1];
- memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count);
-#if DEBUG_CORE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n",
"NOTIFY_CONNECT");
-#endif
cnm->peer = *neighbour;
send_to_client (client, &cnm->header, GNUNET_NO);
}
* or types processed by the respective peer.
*
* @param neighbour identity of the neighbour that changed status
- * @param atsi performance information about neighbour
- * @param atsi_count number of entries in 'ats' array
* @param tmap_old previous type map for the neighbour, NULL for disconnect
* @param tmap_new updated type map for the neighbour, NULL for disconnect
*/
void
GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity
*neighbour,
- const struct GNUNET_ATS_Information
- *atsi, unsigned int atsi_count,
const struct GSC_TypeMap *tmap_old,
const struct GSC_TypeMap *tmap_new)
{
struct GSC_Client *c;
for (c = client_head; c != NULL; c = c->next)
- GSC_CLIENTS_notify_client_about_neighbour (c, neighbour, atsi, atsi_count,
+ GSC_CLIENTS_notify_client_about_neighbour (c, neighbour,
tmap_old, tmap_new);
}
* of its types.
*
* @param sender peer who sent us the message
- * @param atsi performance information about neighbour
- * @param atsi_count number of entries in 'ats' array
* @param msg the message
* @param msize number of bytes to transmit
* @param options options for checking which clients should
*/
void
GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
- const struct GNUNET_ATS_Information *atsi,
- unsigned int atsi_count,
const struct GNUNET_MessageHeader *msg,
uint16_t msize,
- uint32_t options)
+ uint32_t options)
{
- size_t size =
- msize + sizeof (struct NotifyTrafficMessage) +
- atsi_count * sizeof (struct GNUNET_ATS_Information);
+ size_t size = msize + sizeof (struct NotifyTrafficMessage);
char buf[size] GNUNET_ALIGN;
struct NotifyTrafficMessage *ntm;
- struct GNUNET_ATS_Information *a;
- if (0 == options)
- {
- GNUNET_snprintf (buf, sizeof (buf),
- gettext_noop ("# bytes of messages of type %u received"),
- (unsigned int) ntohs (msg->type));
- GNUNET_STATISTICS_update (GSC_stats, buf, msize, GNUNET_NO);
- }
if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
/* recovery strategy: throw performance data away... */
- atsi_count = 0;
size = msize + sizeof (struct NotifyTrafficMessage);
}
if (! ( (0 != (all_client_options & options)) ||
ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND);
else
ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND);
- ntm->ats_count = htonl (atsi_count);
ntm->peer = *sender;
- a = (struct GNUNET_ATS_Information*) &ntm[1];
- memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count);
- memcpy (&a[atsi_count], msg, msize);
+ memcpy (&ntm[1], msg, msize);
send_to_all_clients (sender, &ntm->header, GNUNET_YES, options,
ntohs (msg->type));
}
{&GSC_SESSIONS_handle_client_iterate_peers, NULL,
GNUNET_MESSAGE_TYPE_CORE_ITERATE_PEERS,
sizeof (struct GNUNET_MessageHeader)},
- {&GSC_SESSIONS_handle_client_have_peer, NULL,
- GNUNET_MESSAGE_TYPE_CORE_PEER_CONNECTED,
- sizeof (struct GNUNET_MessageHeader) +
- sizeof (struct GNUNET_PeerIdentity)},
{&handle_client_send_request, NULL,
GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST,
sizeof (struct SendMessageRequest)},
GNUNET_SERVER_notification_context_destroy (notifier);
notifier = NULL;
}
- GNUNET_SERVER_mst_destroy (client_mst);
- client_mst = NULL;
+ if (NULL != client_mst)
+ {
+ GNUNET_SERVER_mst_destroy (client_mst);
+ client_mst = NULL;
+ }
}
/* end of gnunet-service-core_clients.c */