diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-06-08 15:02:38 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-06-08 15:02:38 +0000 |
commit | 08fa8bf18d4f7af3fc1a74a882980f8ff6dbf5bd (patch) | |
tree | c4099d148c02ac213ba1a48a6a9e712890f1a2f8 /src | |
parent | 45729373b4b4ba643a90991503cac3da21a2796f (diff) | |
download | gnunet-08fa8bf18d4f7af3fc1a74a882980f8ff6dbf5bd.tar.gz gnunet-08fa8bf18d4f7af3fc1a74a882980f8ff6dbf5bd.zip |
- add per-peer core queues
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_new.c | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/src/mesh/gnunet-service-mesh_new.c b/src/mesh/gnunet-service-mesh_new.c index f0efc11f4..65f3ee240 100644 --- a/src/mesh/gnunet-service-mesh_new.c +++ b/src/mesh/gnunet-service-mesh_new.c | |||
@@ -225,6 +225,21 @@ struct MeshPeerInfo | |||
225 | * Number of tunnels this peers participates in | 225 | * Number of tunnels this peers participates in |
226 | */ | 226 | */ |
227 | unsigned int ntunnels; | 227 | unsigned int ntunnels; |
228 | |||
229 | /** | ||
230 | * Transmission queue to core DLL head | ||
231 | */ | ||
232 | struct MeshPeerQueue *queue_head; | ||
233 | |||
234 | /** | ||
235 | * Transmission queue to core DLL tail | ||
236 | */ | ||
237 | struct MeshPeerQueue *queue_tail; | ||
238 | |||
239 | /** | ||
240 | * Handle to for queued transmissions | ||
241 | */ | ||
242 | struct GNUNET_CORE_TransmitHandle *core_transmit; | ||
228 | }; | 243 | }; |
229 | 244 | ||
230 | 245 | ||
@@ -475,12 +490,6 @@ static struct MeshClient *clients; | |||
475 | static struct MeshClient *clients_tail; | 490 | static struct MeshClient *clients_tail; |
476 | 491 | ||
477 | /** | 492 | /** |
478 | * Transmission queue to core | ||
479 | */ | ||
480 | struct MeshPeerQueue *queue_head; | ||
481 | struct MeshPeerQueue *queue_tail; | ||
482 | |||
483 | /** | ||
484 | * Tunnels known, indexed by MESH_TunnelID (MeshTunnel) | 493 | * Tunnels known, indexed by MESH_TunnelID (MeshTunnel) |
485 | */ | 494 | */ |
486 | static struct GNUNET_CONTAINER_MultiHashMap *tunnels; | 495 | static struct GNUNET_CONTAINER_MultiHashMap *tunnels; |
@@ -507,11 +516,6 @@ static struct GNUNET_CONTAINER_MultiHashMap *peers; | |||
507 | static struct GNUNET_CORE_Handle *core_handle; | 516 | static struct GNUNET_CORE_Handle *core_handle; |
508 | 517 | ||
509 | /** | 518 | /** |
510 | * Handle to for queued transmissions | ||
511 | */ | ||
512 | struct GNUNET_CORE_TransmitHandle *core_transmit; | ||
513 | |||
514 | /** | ||
515 | * Handle to use DHT | 519 | * Handle to use DHT |
516 | */ | 520 | */ |
517 | static struct GNUNET_DHT_Handle *dht_handle; | 521 | static struct GNUNET_DHT_Handle *dht_handle; |
@@ -2639,7 +2643,9 @@ queue_destroy (struct MeshPeerQueue *queue, int clear_cls) | |||
2639 | } | 2643 | } |
2640 | GNUNET_free_non_null (queue->cls); | 2644 | GNUNET_free_non_null (queue->cls); |
2641 | } | 2645 | } |
2642 | GNUNET_CONTAINER_DLL_remove (queue_head, queue_tail, queue); | 2646 | GNUNET_CONTAINER_DLL_remove (queue->peer->queue_head, |
2647 | queue->peer->queue_tail, | ||
2648 | queue); | ||
2643 | GNUNET_free (queue); | 2649 | GNUNET_free (queue); |
2644 | } | 2650 | } |
2645 | 2651 | ||
@@ -2660,8 +2666,8 @@ queue_send (void *cls, size_t size, void *buf) | |||
2660 | struct MeshPeerQueue *queue; | 2666 | struct MeshPeerQueue *queue; |
2661 | size_t data_size; | 2667 | size_t data_size; |
2662 | 2668 | ||
2663 | core_transmit = NULL; | 2669 | peer->core_transmit = NULL; |
2664 | queue = queue_head; | 2670 | queue = peer->queue_head; |
2665 | 2671 | ||
2666 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* Queue send\n"); | 2672 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* Queue send\n"); |
2667 | 2673 | ||
@@ -2680,7 +2686,7 @@ queue_send (void *cls, size_t size, void *buf) | |||
2680 | struct GNUNET_PeerIdentity id; | 2686 | struct GNUNET_PeerIdentity id; |
2681 | 2687 | ||
2682 | GNUNET_PEER_resolve (peer->id, &id); | 2688 | GNUNET_PEER_resolve (peer->id, &id); |
2683 | core_transmit = | 2689 | peer->core_transmit = |
2684 | GNUNET_CORE_notify_transmit_ready(core_handle, | 2690 | GNUNET_CORE_notify_transmit_ready(core_handle, |
2685 | 0, | 2691 | 0, |
2686 | 0, | 2692 | 0, |
@@ -2722,19 +2728,19 @@ queue_send (void *cls, size_t size, void *buf) | |||
2722 | queue_destroy(queue, GNUNET_NO); | 2728 | queue_destroy(queue, GNUNET_NO); |
2723 | 2729 | ||
2724 | /* If more data in queue, send next */ | 2730 | /* If more data in queue, send next */ |
2725 | if (NULL != queue_head) | 2731 | if (NULL != peer->queue_head) |
2726 | { | 2732 | { |
2727 | struct GNUNET_PeerIdentity id; | 2733 | struct GNUNET_PeerIdentity id; |
2728 | 2734 | ||
2729 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* more data!\n"); | 2735 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* more data!\n"); |
2730 | GNUNET_PEER_resolve (peer->id, &id); | 2736 | GNUNET_PEER_resolve (peer->id, &id); |
2731 | core_transmit = | 2737 | peer->core_transmit = |
2732 | GNUNET_CORE_notify_transmit_ready(core_handle, | 2738 | GNUNET_CORE_notify_transmit_ready(core_handle, |
2733 | 0, | 2739 | 0, |
2734 | 0, | 2740 | 0, |
2735 | GNUNET_TIME_UNIT_FOREVER_REL, | 2741 | GNUNET_TIME_UNIT_FOREVER_REL, |
2736 | &id, | 2742 | &id, |
2737 | queue_head->size, | 2743 | peer->queue_head->size, |
2738 | &queue_send, | 2744 | &queue_send, |
2739 | peer); | 2745 | peer); |
2740 | } | 2746 | } |
@@ -2761,13 +2767,13 @@ queue_add (void *cls, uint16_t type, size_t size, struct MeshPeerInfo *dst) | |||
2761 | queue->type = type; | 2767 | queue->type = type; |
2762 | queue->size = size; | 2768 | queue->size = size; |
2763 | queue->peer = dst; | 2769 | queue->peer = dst; |
2764 | GNUNET_CONTAINER_DLL_insert_tail (queue_head, queue_tail, queue); | 2770 | GNUNET_CONTAINER_DLL_insert_tail (dst->queue_head, dst->queue_tail, queue); |
2765 | if (NULL == core_transmit) | 2771 | if (NULL == dst->core_transmit) |
2766 | { | 2772 | { |
2767 | struct GNUNET_PeerIdentity id; | 2773 | struct GNUNET_PeerIdentity id; |
2768 | 2774 | ||
2769 | GNUNET_PEER_resolve (dst->id, &id); | 2775 | GNUNET_PEER_resolve (dst->id, &id); |
2770 | core_transmit = | 2776 | dst->core_transmit = |
2771 | GNUNET_CORE_notify_transmit_ready(core_handle, | 2777 | GNUNET_CORE_notify_transmit_ready(core_handle, |
2772 | 0, | 2778 | 0, |
2773 | 0, | 2779 | 0, |
@@ -4612,7 +4618,7 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
4612 | GNUNET_break (0); | 4618 | GNUNET_break (0); |
4613 | return; | 4619 | return; |
4614 | } | 4620 | } |
4615 | q = queue_head; | 4621 | q = pi->queue_head; |
4616 | while (NULL != q) | 4622 | while (NULL != q) |
4617 | { | 4623 | { |
4618 | n = q->next; | 4624 | n = q->next; |
@@ -4670,7 +4676,7 @@ shutdown_peer (void *cls, const GNUNET_HashCode * key, void *value) | |||
4670 | struct MeshPeerQueue *q; | 4676 | struct MeshPeerQueue *q; |
4671 | struct MeshPeerQueue *n; | 4677 | struct MeshPeerQueue *n; |
4672 | 4678 | ||
4673 | q = queue_head; | 4679 | q = p->queue_head; |
4674 | while (NULL != q) | 4680 | while (NULL != q) |
4675 | { | 4681 | { |
4676 | n = q->next; | 4682 | n = q->next; |