/**
* Hashmap contain all peers currently manipulated
*/
- struct GNUNET_CONTAINER_MultiHashMap *peers;
+ struct GNUNET_CONTAINER_MultiPeerMap *peers;
/**
* Peer containing information for general manipulation
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received traffic metrics for peer `%s'\n",
GNUNET_i2s(&tm->peer));
- if (NULL == (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &tm->peer.hashPubKey)))
+ if (NULL == (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, &tm->peer)))
{
tmp = GNUNET_malloc (sizeof (struct TM_Peer));
tmp->peer = (tm->peer);
tmp->metrics[c][c2] = UINT32_MAX;
}
}
- GNUNET_CONTAINER_multihashmap_put (man_handle.peers, &tm->peer.hashPubKey, tmp, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ GNUNET_CONTAINER_multipeermap_put (man_handle.peers,
+ &tm->peer, tmp,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
}
ats = (struct GNUNET_ATS_Information *) &tm[1];
size_t msg_size, struct GNUNET_TIME_Relative timeout,
GST_NeighbourSendContinuation cont, void *cont_cls)
{
- struct TM_Peer *tmp;
- struct DelayQueueEntry *dqe;
- struct GNUNET_TIME_Relative delay;
+ struct TM_Peer *tmp;
+ struct DelayQueueEntry *dqe;
+ struct GNUNET_TIME_Relative delay;
- if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &target->hashPubKey)))
- {
- GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target));
- /* Manipulate here */
- /* Delay */
- if (UINT32_MAX != find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND))
- {
- /* We have a delay */
- delay.rel_value_us = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND);
- dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size);
- dqe->id = *target;
- dqe->tmp = tmp;
- dqe->sent_at = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), delay);
- dqe->cont = cont;
- dqe->cont_cls = cont_cls;
- dqe->msg = &dqe[1];
- dqe->msg_size = msg_size;
- dqe->timeout = timeout;
- memcpy (dqe->msg, msg, msg_size);
- GNUNET_CONTAINER_DLL_insert_tail (tmp->send_head, tmp->send_tail, dqe);
- if (GNUNET_SCHEDULER_NO_TASK == tmp->send_delay_task)
- tmp->send_delay_task =GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Delaying %u byte message to peer `%s' with generic delay for %ms\n",
- msg_size, GNUNET_i2s (target),
- GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
- return;
- }
- }
- else if (UINT32_MAX != find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND))
- {
- GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target));
- /* We have a delay */
- delay.rel_value_us = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND);
- dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size);
- dqe->id = *target;
- dqe->tmp = NULL;
- dqe->sent_at = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), delay);
- dqe->cont = cont;
- dqe->cont_cls = cont_cls;
- dqe->msg = &dqe[1];
- dqe->msg_size = msg_size;
- dqe->timeout = timeout;
- memcpy (dqe->msg, msg, msg_size);
- GNUNET_CONTAINER_DLL_insert_tail (generic_dqe_head, generic_dqe_tail, dqe);
- if (GNUNET_SCHEDULER_NO_TASK == generic_send_delay_task)
- {
- generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe);
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Delaying %u byte message to peer `%s' with peer specific delay for %s\n",
- msg_size, GNUNET_i2s (target),
- GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
- return;
- }
+ if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, target)))
+ {
+ GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target));
+ /* Manipulate here */
+ /* Delay */
+ if (UINT32_MAX != find_metric(tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND))
+ {
+ /* We have a delay */
+ delay.rel_value_us = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND);
+ dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size);
+ dqe->id = *target;
+ dqe->tmp = tmp;
+ dqe->sent_at = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), delay);
+ dqe->cont = cont;
+ dqe->cont_cls = cont_cls;
+ dqe->msg = &dqe[1];
+ dqe->msg_size = msg_size;
+ dqe->timeout = timeout;
+ memcpy (dqe->msg, msg, msg_size);
+ GNUNET_CONTAINER_DLL_insert_tail (tmp->send_head, tmp->send_tail, dqe);
+ if (GNUNET_SCHEDULER_NO_TASK == tmp->send_delay_task)
+ tmp->send_delay_task =GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Delaying %u byte message to peer `%s' with generic delay for %ms\n",
+ msg_size, GNUNET_i2s (target),
+ GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
+ return;
+ }
+ }
+ else if (UINT32_MAX != find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND))
+ {
+ GNUNET_break (GNUNET_YES == GST_neighbours_test_connected(target));
+ /* We have a delay */
+ delay.rel_value_us = find_metric (&man_handle.general, GNUNET_ATS_QUALITY_NET_DELAY, TM_SEND);
+ dqe = GNUNET_malloc (sizeof (struct DelayQueueEntry) + msg_size);
+ dqe->id = *target;
+ dqe->tmp = NULL;
+ dqe->sent_at = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get(), delay);
+ dqe->cont = cont;
+ dqe->cont_cls = cont_cls;
+ dqe->msg = &dqe[1];
+ dqe->msg_size = msg_size;
+ dqe->timeout = timeout;
+ memcpy (dqe->msg, msg, msg_size);
+ GNUNET_CONTAINER_DLL_insert_tail (generic_dqe_head, generic_dqe_tail, dqe);
+ if (GNUNET_SCHEDULER_NO_TASK == generic_send_delay_task)
+ {
+ generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &send_delayed, dqe);
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Delaying %u byte message to peer `%s' with peer specific delay for %s\n",
+ msg_size, GNUNET_i2s (target),
+ GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
+ return;
+ }
- /* Normal sending */
- GST_neighbours_send (target, msg, msg_size, timeout, cont, cont_cls);
+ /* Normal sending */
+ GST_neighbours_send (target, msg, msg_size, timeout, cont, cont_cls);
}
uint32_t m_tmp;
uint32_t g_tmp;
int d;
- tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey);
+ tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer);
for (d = 0; d < ats_count; d++)
{
else
m_delay = GNUNET_TIME_UNIT_ZERO;
- if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey)))
+ if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer)))
{
/* Manipulate receive delay */
p_recv_delay = find_metric (tmp, GNUNET_ATS_QUALITY_NET_DELAY, TM_RECEIVE);
GNUNET_ATS_QUALITY_NET_DELAY,
delay.rel_value_us);
}
- man_handle.peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
+ man_handle.peers = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
}
static int
free_tmps (void *cls,
- const struct GNUNET_HashCode * key,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct DelayQueueEntry *dqe;
{
struct TM_Peer *tmp = (struct TM_Peer *) value;
- if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (man_handle.peers, key, value))
+ if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove (man_handle.peers, key, value))
GNUNET_break (0);
free_metric (tmp);
next = tmp->send_head;
struct DelayQueueEntry *dqe;
struct DelayQueueEntry *next;
- if (NULL != (tmp = GNUNET_CONTAINER_multihashmap_get (man_handle.peers, &peer->hashPubKey)))
+ if (NULL != (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, peer)))
{
next = tmp->send_head;
while (NULL != (dqe = next))
{
struct DelayQueueEntry *cur;
struct DelayQueueEntry *next;
- GNUNET_CONTAINER_multihashmap_iterate (man_handle.peers, &free_tmps,NULL);
- GNUNET_CONTAINER_multihashmap_destroy (man_handle.peers);
+ GNUNET_CONTAINER_multipeermap_iterate (man_handle.peers, &free_tmps,NULL);
+ GNUNET_CONTAINER_multipeermap_destroy (man_handle.peers);
next = generic_dqe_head;
while (NULL != (cur = next))