diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-04-10 09:15:39 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-04-10 09:15:39 +0000 |
commit | 5f012e7bccf32d9a3bb9d59cdd0a86fadd2ec66c (patch) | |
tree | 41d5778c2099fe895f614d1938956abe2532030f /src/mesh | |
parent | 949da02c84c83929044e15bc25c0a7b9ffa7427b (diff) | |
download | gnunet-5f012e7bccf32d9a3bb9d59cdd0a86fadd2ec66c.tar.gz gnunet-5f012e7bccf32d9a3bb9d59cdd0a86fadd2ec66c.zip |
- keep track of connection pids on queueing/sending
Diffstat (limited to 'src/mesh')
-rw-r--r-- | src/mesh/gnunet-service-mesh_connection.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c index e355b9e2b..ad19c49b8 100644 --- a/src/mesh/gnunet-service-mesh_connection.c +++ b/src/mesh/gnunet-service-mesh_connection.c | |||
@@ -239,6 +239,11 @@ struct MeshConnectionQueue | |||
239 | int forced; | 239 | int forced; |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * Packet ID of the message, if relevant. | ||
243 | */ | ||
244 | uint32_t pid; | ||
245 | |||
246 | /** | ||
242 | * Continuation to call once sent. | 247 | * Continuation to call once sent. |
243 | */ | 248 | */ |
244 | GMC_sent cont; | 249 | GMC_sent cont; |
@@ -620,7 +625,7 @@ message_sent (void *cls, | |||
620 | 625 | ||
621 | case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: | 626 | case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED: |
622 | if (GNUNET_YES == sent) | 627 | if (GNUNET_YES == sent) |
623 | fc->last_pid_sent++; | 628 | fc->last_pid_sent = q->pid; |
624 | 629 | ||
625 | LOG (GNUNET_ERROR_TYPE_DEBUG, "! Q_N- %p %u\n", fc, fc->queue_n); | 630 | LOG (GNUNET_ERROR_TYPE_DEBUG, "! Q_N- %p %u\n", fc, fc->queue_n); |
626 | if (GNUNET_NO == forced) | 631 | if (GNUNET_NO == forced) |
@@ -1952,9 +1957,10 @@ handle_mesh_encrypted (const struct GNUNET_PeerIdentity *peer, | |||
1952 | if (GM_is_pid_bigger (pid, fc->last_ack_sent)) | 1957 | if (GM_is_pid_bigger (pid, fc->last_ack_sent)) |
1953 | { | 1958 | { |
1954 | GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO); | 1959 | GNUNET_STATISTICS_update (stats, "# unsolicited message", 1, GNUNET_NO); |
1955 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1960 | GNUNET_break_op (0); |
1956 | "WARNING Received PID %u, (prev %u), ACK %u\n", | 1961 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1957 | pid, fc->last_pid_recv, fc->last_ack_sent); | 1962 | "Received PID %u, (prev %u), ACK %u\n", |
1963 | pid, fc->last_pid_recv, fc->last_ack_sent); | ||
1958 | return GNUNET_OK; | 1964 | return GNUNET_OK; |
1959 | } | 1965 | } |
1960 | if (GNUNET_NO == GM_is_pid_bigger (pid, fc->last_pid_recv)) | 1966 | if (GNUNET_NO == GM_is_pid_bigger (pid, fc->last_pid_recv)) |
@@ -2775,8 +2781,9 @@ GMC_is_sendable (struct MeshConnection *c, int fwd) | |||
2775 | return GNUNET_YES; | 2781 | return GNUNET_YES; |
2776 | } | 2782 | } |
2777 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 2783 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
2778 | LOG (GNUNET_ERROR_TYPE_DEBUG, " last ack recv: %u, last pid sent: %u\n", | 2784 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2779 | fc->last_ack_recv, fc->last_pid_sent); | 2785 | " last ack recv: %u, last pid sent: %u, next pid %u\n", |
2786 | fc->last_ack_recv, fc->last_pid_sent, fc->next_pid); | ||
2780 | if (GM_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) | 2787 | if (GM_is_pid_bigger (fc->last_ack_recv, fc->last_pid_sent)) |
2781 | return GNUNET_YES; | 2788 | return GNUNET_YES; |
2782 | return GNUNET_NO; | 2789 | return GNUNET_NO; |
@@ -2805,6 +2812,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2805 | { | 2812 | { |
2806 | struct MeshFlowControl *fc; | 2813 | struct MeshFlowControl *fc; |
2807 | struct MeshConnectionQueue *q; | 2814 | struct MeshConnectionQueue *q; |
2815 | uint32_t pid; | ||
2808 | void *data; | 2816 | void *data; |
2809 | size_t size; | 2817 | size_t size; |
2810 | uint16_t type; | 2818 | uint16_t type; |
@@ -2819,6 +2827,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2819 | 2827 | ||
2820 | fc = fwd ? &c->fwd_fc : &c->bck_fc; | 2828 | fc = fwd ? &c->fwd_fc : &c->bck_fc; |
2821 | droppable = GNUNET_NO == force; | 2829 | droppable = GNUNET_NO == force; |
2830 | pid = 0; | ||
2822 | switch (type) | 2831 | switch (type) |
2823 | { | 2832 | { |
2824 | struct GNUNET_MESH_Encrypted *emsg; | 2833 | struct GNUNET_MESH_Encrypted *emsg; |
@@ -2840,14 +2849,15 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2840 | } | 2849 | } |
2841 | emsg->cid = c->id; | 2850 | emsg->cid = c->id; |
2842 | emsg->ttl = htonl (ttl - 1); | 2851 | emsg->ttl = htonl (ttl - 1); |
2843 | emsg->pid = htonl (fc->next_pid++); | 2852 | pid = fc->next_pid++; |
2853 | emsg->pid = htonl (pid); | ||
2844 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n); | 2854 | LOG (GNUNET_ERROR_TYPE_DEBUG, " Q_N+ %p %u\n", fc, fc->queue_n); |
2855 | LOG (GNUNET_ERROR_TYPE_DEBUG, "pid %u\n", pid); | ||
2856 | LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid sent %u\n", fc->last_pid_sent); | ||
2857 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ack recv %u\n", fc->last_ack_recv); | ||
2845 | if (GNUNET_YES == droppable) | 2858 | if (GNUNET_YES == droppable) |
2846 | { | 2859 | { |
2847 | fc->queue_n++; | 2860 | fc->queue_n++; |
2848 | LOG (GNUNET_ERROR_TYPE_DEBUG, "pid %u\n", ntohl (emsg->pid)); | ||
2849 | LOG (GNUNET_ERROR_TYPE_DEBUG, "last pid sent %u\n", fc->last_pid_sent); | ||
2850 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ack recv %u\n", fc->last_ack_recv); | ||
2851 | } | 2861 | } |
2852 | else | 2862 | else |
2853 | { | 2863 | { |
@@ -2923,6 +2933,7 @@ GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message, | |||
2923 | 2933 | ||
2924 | q = GNUNET_new (struct MeshConnectionQueue); | 2934 | q = GNUNET_new (struct MeshConnectionQueue); |
2925 | q->forced = !droppable; | 2935 | q->forced = !droppable; |
2936 | q->pid = pid; | ||
2926 | q->q = GMP_queue_add (get_hop (c, fwd), data, type, size, c, fwd, | 2937 | q->q = GMP_queue_add (get_hop (c, fwd), data, type, size, c, fwd, |
2927 | &message_sent, q); | 2938 | &message_sent, q); |
2928 | if (NULL == q->q) | 2939 | if (NULL == q->q) |