aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-07-15 22:37:05 +0000
committerBart Polot <bart@net.in.tum.de>2013-07-15 22:37:05 +0000
commit9f64f743ec799d235bb566fc685ba1459962ff17 (patch)
tree978bf3851e5cc0e22a058eade8a8a83ac423f724 /src
parent860eeebfb1fd949474e74a23259d222b7563ba70 (diff)
downloadgnunet-9f64f743ec799d235bb566fc685ba1459962ff17.tar.gz
gnunet-9f64f743ec799d235bb566fc685ba1459962ff17.zip
- change MID to 32bits, allow overflow (fixes lost packet 0)
Diffstat (limited to 'src')
-rw-r--r--src/mesh/gnunet-service-mesh.c104
-rw-r--r--src/mesh/mesh_protocol.h14
2 files changed, 58 insertions, 60 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 7d703738d..1b8e14c20 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -308,7 +308,7 @@ struct MeshReliableMessage
308 /** 308 /**
309 * ID of the message (ACK needed to free) 309 * ID of the message (ACK needed to free)
310 */ 310 */
311 uint64_t mid; 311 uint32_t mid;
312 312
313 /** 313 /**
314 * When was this message issued (to calculate ACK delay) FIXME update with traffic 314 * When was this message issued (to calculate ACK delay) FIXME update with traffic
@@ -340,7 +340,7 @@ struct MeshTunnelReliability
340 /** 340 /**
341 * Next MID to use. 341 * Next MID to use.
342 */ 342 */
343 uint64_t mid_sent; 343 uint32_t mid_sent;
344 344
345 /** 345 /**
346 * DLL of messages received out of order. 346 * DLL of messages received out of order.
@@ -351,7 +351,7 @@ struct MeshTunnelReliability
351 /** 351 /**
352 * Next MID expected. 352 * Next MID expected.
353 */ 353 */
354 uint64_t mid_recv; 354 uint32_t mid_recv;
355 355
356 /** 356 /**
357 * Task to resend/poll in case no ACK is received. 357 * Task to resend/poll in case no ACK is received.
@@ -2107,7 +2107,7 @@ tunnel_send_data_ack (struct MeshTunnel *t, int fwd)
2107 rel = fwd ? t->bck_rel : t->fwd_rel; 2107 rel = fwd ? t->bck_rel : t->fwd_rel;
2108 hop = fwd ? t->prev_hop : t->next_hop; 2108 hop = fwd ? t->prev_hop : t->next_hop;
2109 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2109 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2110 "send_data_ack for %llu\n", 2110 "send_data_ack for %u\n",
2111 rel->mid_recv - 1); 2111 rel->mid_recv - 1);
2112 2112
2113 if (GNUNET_NO == t->reliable) 2113 if (GNUNET_NO == t->reliable)
@@ -2120,7 +2120,7 @@ tunnel_send_data_ack (struct MeshTunnel *t, int fwd)
2120 msg.header.size = htons (sizeof (msg)); 2120 msg.header.size = htons (sizeof (msg));
2121 msg.tid = htonl (t->id.tid); 2121 msg.tid = htonl (t->id.tid);
2122 GNUNET_PEER_resolve (t->id.oid, &msg.oid); 2122 GNUNET_PEER_resolve (t->id.oid, &msg.oid);
2123 msg.mid = GNUNET_htonll (rel->mid_recv - 1); 2123 msg.mid = htonl (rel->mid_recv - 1);
2124 msg.futures = 0; 2124 msg.futures = 0;
2125 for (copy = rel->head_recv; NULL != copy; copy = copy->next) 2125 for (copy = rel->head_recv; NULL != copy; copy = copy->next)
2126 { 2126 {
@@ -2161,7 +2161,7 @@ tunnel_send_ack (struct MeshTunnel *t, uint16_t type, int fwd)
2161 struct MeshClient *c; 2161 struct MeshClient *c;
2162 struct MeshClient *o; 2162 struct MeshClient *o;
2163 GNUNET_PEER_Id hop; 2163 GNUNET_PEER_Id hop;
2164 uint64_t delta_mid; 2164 uint32_t delta_mid;
2165 uint32_t ack; 2165 uint32_t ack;
2166 int delta; 2166 int delta;
2167 2167
@@ -2331,8 +2331,8 @@ tunnel_send_client_buffered_data (struct MeshTunnel *t, struct MeshClient *c,
2331 struct GNUNET_MESH_Data *msg = (struct GNUNET_MESH_Data *) &copy[1]; 2331 struct GNUNET_MESH_Data *msg = (struct GNUNET_MESH_Data *) &copy[1];
2332 2332
2333 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2333 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2334 " have %llu! now expecting %llu\n", 2334 " have %u! now expecting %u\n",
2335 copy->mid, rel->mid_recv + 1LL); 2335 copy->mid, rel->mid_recv + 1);
2336 tunnel_send_client_data (t, msg, (rel == t->bck_rel)); 2336 tunnel_send_client_data (t, msg, (rel == t->bck_rel));
2337 rel->mid_recv++; 2337 rel->mid_recv++;
2338 GNUNET_CONTAINER_DLL_remove (rel->head_recv, rel->tail_recv, copy); 2338 GNUNET_CONTAINER_DLL_remove (rel->head_recv, rel->tail_recv, copy);
@@ -2341,7 +2341,7 @@ tunnel_send_client_buffered_data (struct MeshTunnel *t, struct MeshClient *c,
2341 else 2341 else
2342 { 2342 {
2343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2344 " don't have %llu, next is %llu\n", 2344 " don't have %u, next is %u\n",
2345 rel->mid_recv, 2345 rel->mid_recv,
2346 copy->mid); 2346 copy->mid);
2347 return; 2347 return;
@@ -2366,12 +2366,12 @@ tunnel_add_buffered_data (struct MeshTunnel *t,
2366{ 2366{
2367 struct MeshReliableMessage *copy; 2367 struct MeshReliableMessage *copy;
2368 struct MeshReliableMessage *prev; 2368 struct MeshReliableMessage *prev;
2369 uint64_t mid; 2369 uint32_t mid;
2370 uint16_t size; 2370 uint16_t size;
2371 2371
2372 size = ntohs (msg->header.size); 2372 size = ntohs (msg->header.size);
2373 mid = GNUNET_ntohll (msg->mid); 2373 mid = ntohl (msg->mid);
2374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data %llu\n", mid); 2374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add_buffered_data %u\n", mid);
2375 2375
2376 copy = GNUNET_malloc (sizeof (*copy) + size); 2376 copy = GNUNET_malloc (sizeof (*copy) + size);
2377 copy->mid = mid; 2377 copy->mid = mid;
@@ -2382,8 +2382,8 @@ tunnel_add_buffered_data (struct MeshTunnel *t,
2382 // FIXME start from the end (most messages are the latest ones) 2382 // FIXME start from the end (most messages are the latest ones)
2383 for (prev = rel->head_recv; NULL != prev; prev = prev->next) 2383 for (prev = rel->head_recv; NULL != prev; prev = prev->next)
2384 { 2384 {
2385 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " prev %llu\n", prev->mid); 2385 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " prev %u\n", prev->mid);
2386 if (mid < prev->mid) 2386 if (GMC_is_pid_bigger (prev->mid, mid))
2387 { 2387 {
2388 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " bingo!\n"); 2388 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " bingo!\n");
2389 GNUNET_CONTAINER_DLL_insert_before (rel->head_recv, rel->tail_recv, 2389 GNUNET_CONTAINER_DLL_insert_before (rel->head_recv, rel->tail_recv,
@@ -2416,7 +2416,7 @@ tunnel_free_reliable_message (struct MeshReliableMessage *copy)
2416 rel->expected_delay.rel_value += time.rel_value; 2416 rel->expected_delay.rel_value += time.rel_value;
2417 rel->expected_delay.rel_value /= 8; 2417 rel->expected_delay.rel_value /= 8;
2418 rel->n_sent--; 2418 rel->n_sent--;
2419 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %llu\n", copy->mid); 2419 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Freeing %u\n", copy->mid);
2420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent); 2420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " n_sent %u\n", rel->n_sent);
2421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! took %s\n", 2421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! took %s\n",
2422 GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO)); 2422 GNUNET_STRINGS_relative_time_to_string (time, GNUNET_NO));
@@ -2445,14 +2445,14 @@ tunnel_free_sent_reliable (struct MeshTunnel *t,
2445 struct MeshReliableMessage *next; 2445 struct MeshReliableMessage *next;
2446 uint64_t bitfield; 2446 uint64_t bitfield;
2447 uint64_t mask; 2447 uint64_t mask;
2448 uint64_t mid; 2448 uint32_t mid;
2449 uint64_t target; 2449 uint32_t target;
2450 unsigned int i; 2450 unsigned int i;
2451 2451
2452 bitfield = msg->futures; 2452 bitfield = msg->futures;
2453 mid = GNUNET_ntohll (msg->mid); 2453 mid = ntohl (msg->mid);
2454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2454 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2455 "free_sent_reliable %llu %llX\n", 2455 "free_sent_reliable %u %llX\n",
2456 mid, bitfield); 2456 mid, bitfield);
2457 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2457 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2458 " rel %p, head %p\n", 2458 " rel %p, head %p\n",
@@ -2462,7 +2462,7 @@ tunnel_free_sent_reliable (struct MeshTunnel *t,
2462 i++) 2462 i++)
2463 { 2463 {
2464 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2464 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2465 " trying bit %u (mid %llu)\n", 2465 " trying bit %u (mid %u)\n",
2466 i, mid + i + 1); 2466 i, mid + i + 1);
2467 mask = 0x1LL << i; 2467 mask = 0x1LL << i;
2468 if (0 == (bitfield & mask)) 2468 if (0 == (bitfield & mask))
@@ -2475,8 +2475,8 @@ tunnel_free_sent_reliable (struct MeshTunnel *t,
2475 /* The i-th bit was set. Do we have that copy? */ 2475 /* The i-th bit was set. Do we have that copy? */
2476 /* Skip copies with mid < target */ 2476 /* Skip copies with mid < target */
2477 target = mid + i + 1; 2477 target = mid + i + 1;
2478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " target %llu\n", target); 2478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " target %u\n", target);
2479 while (NULL != copy && copy->mid < target) 2479 while (NULL != copy && GMC_is_pid_bigger (target, copy->mid))
2480 copy = copy->next; 2480 copy = copy->next;
2481 2481
2482 /* Did we run out of copies? (previously freed, it's ok) */ 2482 /* Did we run out of copies? (previously freed, it's ok) */
@@ -2487,9 +2487,9 @@ tunnel_free_sent_reliable (struct MeshTunnel *t,
2487 } 2487 }
2488 2488
2489 /* Did we overshoot the target? (previously freed, it's ok) */ 2489 /* Did we overshoot the target? (previously freed, it's ok) */
2490 if (copy->mid > target) 2490 if (GMC_is_pid_bigger (copy->mid, target))
2491 { 2491 {
2492 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " next copy %llu\n", copy->mid); 2492 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " next copy %u\n", copy->mid);
2493 continue; 2493 continue;
2494 } 2494 }
2495 2495
@@ -2552,7 +2552,7 @@ tunnel_retransmit_message (void *cls,
2552 /* Message not found in the queue */ 2552 /* Message not found in the queue */
2553 if (NULL == q) 2553 if (NULL == q)
2554 { 2554 {
2555 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %llu\n", copy->mid); 2555 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! RETRANSMIT %u\n", copy->mid);
2556 2556
2557 fc->last_ack_sent++; 2557 fc->last_ack_sent++;
2558 fc->last_pid_recv++; 2558 fc->last_pid_recv++;
@@ -2562,7 +2562,7 @@ tunnel_retransmit_message (void *cls,
2562 } 2562 }
2563 else 2563 else
2564 { 2564 {
2565 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! STILL IN QUEUE %llu\n", copy->mid); 2565 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! STILL IN QUEUE %u\n", copy->mid);
2566 } 2566 }
2567 2567
2568 rel->retry_timer = GNUNET_TIME_STD_BACKOFF (rel->retry_timer); 2568 rel->retry_timer = GNUNET_TIME_STD_BACKOFF (rel->retry_timer);
@@ -3228,8 +3228,8 @@ queue_get_next (const struct MeshPeerInfo *peer)
3228 return q; 3228 return q;
3229 } 3229 }
3230 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3230 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3231 "* ACK: %u, PID: %u, MID: %llu\n", 3231 "* ACK: %u, PID: %u, MID: %u\n",
3232 ack, pid, GNUNET_ntohll (dmsg->mid)); 3232 ack, pid, ntohl (dmsg->mid));
3233 if (GNUNET_NO == GMC_is_pid_bigger (pid, ack)) 3233 if (GNUNET_NO == GMC_is_pid_bigger (pid, ack))
3234 { 3234 {
3235 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3235 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -3361,14 +3361,14 @@ queue_send (void *cls, size_t size, void *buf)
3361 t->next_fc.last_pid_sent = pid; 3361 t->next_fc.last_pid_sent = pid;
3362 tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST, GNUNET_YES); 3362 tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST, GNUNET_YES);
3363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3364 "!!! FWD %llu\n", 3364 "!!! FWD %u\n",
3365 GNUNET_ntohll ( ((struct GNUNET_MESH_Data *) buf)->mid )); 3365 ntohl ( ((struct GNUNET_MESH_Data *) buf)->mid ) );
3366 break; 3366 break;
3367 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: 3367 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
3368 t->prev_fc.last_pid_sent = pid; 3368 t->prev_fc.last_pid_sent = pid;
3369 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3369 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3370 "!!! BCK %llu\n", 3370 "!!! BCK %u\n",
3371 GNUNET_ntohll ( ((struct GNUNET_MESH_Data *) buf)->mid )); 3371 ntohl ( ((struct GNUNET_MESH_Data *) buf)->mid ) );
3372 tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN, GNUNET_NO); 3372 tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN, GNUNET_NO);
3373 break; 3373 break;
3374 default: 3374 default:
@@ -3974,18 +3974,19 @@ handle_mesh_data (const struct GNUNET_PeerIdentity *peer,
3974 GNUNET_STATISTICS_update (stats, "# data received", 1, GNUNET_NO); 3974 GNUNET_STATISTICS_update (stats, "# data received", 1, GNUNET_NO);
3975 if (GMC_is_pid_bigger (pid, fc->last_pid_recv)) 3975 if (GMC_is_pid_bigger (pid, fc->last_pid_recv))
3976 { 3976 {
3977 uint64_t mid; 3977 uint32_t mid;
3978 3978
3979 mid = GNUNET_ntohll (msg->mid); 3979 mid = ntohl (msg->mid);
3980 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3980 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3981 " pid %u (%llu) not seen yet\n", pid, mid); 3981 " pid %u (mid %u) not seen yet\n", pid, mid);
3982 fc->last_pid_recv = pid; 3982 fc->last_pid_recv = pid;
3983 3983
3984 if (GNUNET_NO == t->reliable || 3984 if (GNUNET_NO == t->reliable ||
3985 (mid >= rel->mid_recv && mid <= rel->mid_recv + 64)) 3985 ( !GMC_is_pid_bigger (rel->mid_recv, mid) &&
3986 GMC_is_pid_bigger (rel->mid_recv + 64, mid) ) )
3986 { 3987 {
3987 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3988 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3988 "!!! RECV %llu\n", GNUNET_ntohll (msg->mid)); 3989 "!!! RECV %u\n", ntohl (msg->mid));
3989 if (GNUNET_YES == t->reliable) 3990 if (GNUNET_YES == t->reliable)
3990 { 3991 {
3991 /* Is this the exact next expected messasge? */ 3992 /* Is this the exact next expected messasge? */
@@ -4010,16 +4011,15 @@ handle_mesh_data (const struct GNUNET_PeerIdentity *peer,
4010 else 4011 else
4011 { 4012 {
4012 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4013 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4013 " MID %llu not expected (%llu - %llu), dropping!\n", 4014 " MID %u not expected (%u - %u), dropping!\n",
4014 GNUNET_ntohll (msg->mid), 4015 ntohl (msg->mid), rel->mid_recv, rel->mid_recv + 64);
4015 rel->mid_recv, rel->mid_recv + 64LL);
4016 } 4016 }
4017 } 4017 }
4018 else 4018 else
4019 { 4019 {
4020// GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO); 4020// GNUNET_STATISTICS_update (stats, "# duplicate PID", 1, GNUNET_NO);
4021 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4021 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4022 " Pid %u not expected (%u), dropping!\n", 4022 " Pid %u not expected (%u+), dropping!\n",
4023 pid, fc->last_pid_recv + 1); 4023 pid, fc->last_pid_recv + 1);
4024 } 4024 }
4025 tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST, fwd); 4025 tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_UNICAST, fwd);
@@ -4106,7 +4106,7 @@ handle_mesh_data_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
4106 struct MeshReliableMessage *next; 4106 struct MeshReliableMessage *next;
4107 struct MeshTunnel *t; 4107 struct MeshTunnel *t;
4108 GNUNET_PEER_Id id; 4108 GNUNET_PEER_Id id;
4109 uint64_t ack; 4109 uint32_t ack;
4110 uint16_t type; 4110 uint16_t type;
4111 int work; 4111 int work;
4112 4112
@@ -4122,8 +4122,8 @@ handle_mesh_data_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
4122 GNUNET_STATISTICS_update (stats, "# ack on unknown tunnel", 1, GNUNET_NO); 4122 GNUNET_STATISTICS_update (stats, "# ack on unknown tunnel", 1, GNUNET_NO);
4123 return GNUNET_OK; 4123 return GNUNET_OK;
4124 } 4124 }
4125 ack = GNUNET_ntohll (msg->mid); 4125 ack = ntohl (msg->mid);
4126 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ACK %llu\n", ack); 4126 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ACK %u\n", ack);
4127 4127
4128 /* Is this a forward or backward ACK? */ 4128 /* Is this a forward or backward ACK? */
4129 id = GNUNET_PEER_search (peer); 4129 id = GNUNET_PEER_search (peer);
@@ -4155,17 +4155,17 @@ handle_mesh_data_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
4155 return GNUNET_OK; 4155 return GNUNET_OK;
4156 } 4156 }
4157 4157
4158 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! ACK %llu\n", ack); 4158 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! ACK %u\n", ack);
4159 for (work = GNUNET_NO, copy = rel->head_sent; copy != NULL; copy = next) 4159 for (work = GNUNET_NO, copy = rel->head_sent; copy != NULL; copy = next)
4160 { 4160 {
4161 if (copy->mid > ack) 4161 if (GMC_is_pid_bigger (copy->mid, ack))
4162 { 4162 {
4163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! head %llu, out!\n", copy->mid); 4163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! head %u, out!\n", copy->mid);
4164 tunnel_free_sent_reliable (t, msg, rel); 4164 tunnel_free_sent_reliable (t, msg, rel);
4165 break; 4165 break;
4166 } 4166 }
4167 work = GNUNET_YES; 4167 work = GNUNET_YES;
4168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! id %llu\n", copy->mid); 4168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! id %u\n", copy->mid);
4169 next = copy->next; 4169 next = copy->next;
4170 tunnel_free_reliable_message (copy); 4170 tunnel_free_reliable_message (copy);
4171 } 4171 }
@@ -4948,7 +4948,7 @@ handle_local_data (void *cls, struct GNUNET_SERVER_Client *client,
4948 + sizeof(struct GNUNET_MESH_Data) 4948 + sizeof(struct GNUNET_MESH_Data)
4949 + size); 4949 + size);
4950 copy->mid = rel->mid_sent++; 4950 copy->mid = rel->mid_sent++;
4951 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! DATA %llu\n", copy->mid); 4951 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! DATA %u\n", copy->mid);
4952 copy->timestamp = GNUNET_TIME_absolute_get (); 4952 copy->timestamp = GNUNET_TIME_absolute_get ();
4953 copy->rel = rel; 4953 copy->rel = rel;
4954 rel->n_sent++; 4954 rel->n_sent++;
@@ -4965,14 +4965,12 @@ handle_local_data (void *cls, struct GNUNET_SERVER_Client *client,
4965 rel); 4965 rel);
4966 } 4966 }
4967 payload = (struct GNUNET_MESH_Data *) &copy[1]; 4967 payload = (struct GNUNET_MESH_Data *) &copy[1];
4968 payload->mid = GNUNET_htonll (copy->mid); 4968 payload->mid = htonl (copy->mid);
4969 } 4969 }
4970 else 4970 else
4971 { 4971 {
4972 payload = (struct GNUNET_MESH_Data *) cbuf; 4972 payload = (struct GNUNET_MESH_Data *) cbuf;
4973 payload->mid = GNUNET_htonll ((uint64_t)(fc->last_pid_recv + 1)); 4973 payload->mid = htonl (fc->last_pid_recv + 1);
4974 // FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
4975 // use different struct for unreliable traffic, save 8 bytes
4976 } 4974 }
4977 memcpy (&payload[1], &data_msg[1], size); 4975 memcpy (&payload[1], &data_msg[1], size);
4978 payload->header.size = htons (sizeof (struct GNUNET_MESH_Data) + size); 4976 payload->header.size = htons (sizeof (struct GNUNET_MESH_Data) + size);
diff --git a/src/mesh/mesh_protocol.h b/src/mesh/mesh_protocol.h
index 3bec68796..999019817 100644
--- a/src/mesh/mesh_protocol.h
+++ b/src/mesh/mesh_protocol.h
@@ -133,7 +133,7 @@ struct GNUNET_MESH_Data
133 /** 133 /**
134 * Unique ID of the payload message 134 * Unique ID of the payload message
135 */ 135 */
136 uint64_t mid GNUNET_PACKED; 136 uint32_t mid GNUNET_PACKED;
137 137
138 /** 138 /**
139 * Payload follows 139 * Payload follows
@@ -162,16 +162,16 @@ struct GNUNET_MESH_DataACK
162 struct GNUNET_PeerIdentity oid; 162 struct GNUNET_PeerIdentity oid;
163 163
164 /** 164 /**
165 * Last message ID received. 165 * Bitfield of already-received newer messages
166 */
167 uint64_t mid GNUNET_PACKED;
168
169 /**
170 * Bitfield of already-received newer messages // TODO implement and use
171 * pid + 1 @ LSB 166 * pid + 1 @ LSB
172 * pid + 64 @ MSB 167 * pid + 64 @ MSB
173 */ 168 */
174 uint64_t futures GNUNET_PACKED; 169 uint64_t futures GNUNET_PACKED;
170
171 /**
172 * Last message ID received.
173 */
174 uint32_t mid GNUNET_PACKED;
175}; 175};
176 176
177 177