aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-05-10 15:31:40 +0000
committerBart Polot <bart@net.in.tum.de>2013-05-10 15:31:40 +0000
commitd53c2eea5634af37d4c35067cc9b79c9189591f4 (patch)
tree4ba4cb273e34d9d79f14dd9abcce7f8fb3048a41
parent50fb4ba813b41e436823f6fda964f2652ac4acd4 (diff)
downloadgnunet-d53c2eea5634af37d4c35067cc9b79c9189591f4.tar.gz
gnunet-d53c2eea5634af37d4c35067cc9b79c9189591f4.zip
- implement new fwd/bck flow control mechanism
-rw-r--r--src/mesh/gnunet-service-mesh-new.c346
1 files changed, 169 insertions, 177 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c
index a56daf1f6..72169769e 100644
--- a/src/mesh/gnunet-service-mesh-new.c
+++ b/src/mesh/gnunet-service-mesh-new.c
@@ -247,6 +247,46 @@ struct MeshPeerInfo
247 247
248 248
249/** 249/**
250 * Struct to encapsulate all the Flow Control information to a peer in the
251 * context of a tunnel: Same peer in different tunnels will have independent
252 * flow control structures, allowing to choke/free tunnels according to its
253 * own criteria.
254 */
255struct MeshFlowControl
256{
257 /**
258 * ID of the last packet sent towards the peer.
259 */
260 uint32_t last_pid_sent;
261
262 /**
263 * ID of the last packet received from the peer.
264 */
265 uint32_t last_pid_recv;
266
267 /**
268 * Last ACK sent to the peer (peer can't send more than this PID).
269 */
270 uint32_t last_ack_sent;
271
272 /**
273 * Last ACK sent towards the origin (for traffic towards leaf node).
274 */
275 uint32_t last_ack_recv;
276
277 /**
278 * How many messages are in the queue towards this peer.
279 */
280 uint32_t queue_n;
281
282 /**
283 * Task to poll the peer in case of a lost ACK causes stall.
284 */
285 GNUNET_SCHEDULER_TaskIdentifier poll_task;
286};
287
288
289/**
250 * Globally unique tunnel identification (owner + number) 290 * Globally unique tunnel identification (owner + number)
251 * DO NOT USE OVER THE NETWORK 291 * DO NOT USE OVER THE NETWORK
252 */ 292 */
@@ -297,75 +337,44 @@ struct MeshTunnel
297 int nobuffer; 337 int nobuffer;
298 338
299 /** 339 /**
300 * Packet ID of the last fwd packet seen (sent/retransmitted/received).
301 */
302 uint32_t fwd_pid;
303
304 /**
305 * Packet ID of the last bck packet sent (unique counter per hop).
306 */
307 uint32_t bck_pid;
308
309 /**
310 * Force sending ACK? Flag to allow duplicate ACK on POLL. 340 * Force sending ACK? Flag to allow duplicate ACK on POLL.
311 */ 341 */
312 int force_ack; 342 int force_ack;
313 343
314 /** 344 /**
315 * Last ACK sent towards the origin (for traffic towards leaf node).
316 */
317 uint32_t last_fwd_ack;
318
319 /**
320 * BCK ACK value received from the hop towards the owner of the tunnel,
321 * (previous node / owner): up to what message PID can we sent back to him.
322 */
323 uint32_t bck_ack;
324
325 /**
326 * How many messages are in the forward queue (towards leaves).
327 */
328 unsigned int fwd_queue_n;
329
330 /**
331 * How many messages do we accept in the forward queue. 345 * How many messages do we accept in the forward queue.
332 */ 346 */
333 unsigned int fwd_queue_max; 347 unsigned int queue_max;
334 348
335 /** 349 /**
336 * How many messages are in the backward queue (towards origin). 350 * Last time the tunnel was used
337 */ 351 */
338 unsigned int bck_queue_n; 352 struct GNUNET_TIME_Absolute timestamp;
339 353
340 /** 354 /**
341 * How many messages do we accept in the backward queue. 355 * Destination of the tunnel.
342 */ 356 */
343 unsigned int bck_queue_max; 357 GNUNET_PEER_Id dest;
344 358
345 /** 359 /**
346 * Task to poll peer in case of a stall. 360 * Next hop in the tunnel.
347 */ 361 */
348 GNUNET_SCHEDULER_TaskIdentifier fc_poll_bck; 362 GNUNET_PEER_Id next_hop;
349 363
350 /** 364 /**
351 * Last time the tunnel was used 365 * Previous hop in the tunnel.
352 */ 366 */
353 struct GNUNET_TIME_Absolute timestamp; 367 GNUNET_PEER_Id prev_hop;
354 368
355 /** 369 /**
356 * Peer of the tunnel. 370 * Flow control information about @c next_hop.
357 */ 371 */
358 GNUNET_PEER_Id peer; 372 struct MeshFlowControl next_fc;
359
360 /**
361 * Next hop in the tunnel.
362 */
363 GNUNET_PEER_Id next_hop;
364 373
365 /** 374 /**
366 * Previous hop in the tunnel. 375 * Flow control information about @c prev_hop.
367 */ 376 */
368 GNUNET_PEER_Id prev_hop; 377 struct MeshFlowControl prev_fc;
369 378
370 /** 379 /**
371 * Client owner of the tunnel, if any 380 * Client owner of the tunnel, if any
@@ -373,6 +382,12 @@ struct MeshTunnel
373 struct MeshClient *owner; 382 struct MeshClient *owner;
374 383
375 /** 384 /**
385 * Task to keep the used paths alive at the owner,
386 * time tunnel out on all the other peers.
387 */
388 GNUNET_SCHEDULER_TaskIdentifier maintenance_task;
389
390 /**
376 * Clients that have been informed about and want to stay in the tunnel. 391 * Clients that have been informed about and want to stay in the tunnel.
377 */ 392 */
378 struct MeshClient **clients; 393 struct MeshClient **clients;
@@ -382,7 +397,7 @@ struct MeshTunnel
382 */ 397 */
383 struct MeshTunnelClientInfo *clients_fc; 398 struct MeshTunnelClientInfo *clients_fc;
384 399
385 /** 400 /**
386 * Number of elements in clients/clients_fc 401 * Number of elements in clients/clients_fc
387 */ 402 */
388 unsigned int nclients; 403 unsigned int nclients;
@@ -397,23 +412,10 @@ struct MeshTunnel
397 */ 412 */
398 unsigned int nignore; 413 unsigned int nignore;
399 414
400 /**
401 * Path being used for the tunnel.
402 */
403 struct MeshPeerPath *path;
404
405 /**
406 * Task to keep the used paths alive
407 */
408 GNUNET_SCHEDULER_TaskIdentifier path_refresh_task;
409
410 /** 415 /**
411 * Task to destroy the tunnel after timeout 416 * Path being used for the tunnel.
412 *
413 * FIXME: merge the two? a tunnel will have either
414 * a path refresh OR a timeout, never both!
415 */ 417 */
416 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 418 struct MeshPeerPath *path;
417 419
418 /** 420 /**
419 * Flag to signal the destruction of the tunnel. 421 * Flag to signal the destruction of the tunnel.
@@ -427,9 +429,9 @@ struct MeshTunnel
427 */ 429 */
428 unsigned int pending_messages; 430 unsigned int pending_messages;
429 431
430 /** 432 /**
431 * If the tunnel is empty, destoy it. 433 * If the tunnel is empty, destoy it.
432 */ 434 */
433 GNUNET_SCHEDULER_TaskIdentifier delayed_destroy; 435 GNUNET_SCHEDULER_TaskIdentifier delayed_destroy;
434}; 436};
435 437
@@ -841,7 +843,7 @@ tunnel_add_client (struct MeshTunnel *t, struct MeshClient *c);
841 843
842 844
843/** 845/**
844 * .Use the given path for the tunnel. 846 * Use the given path for the tunnel.
845 * 847 *
846 * @param t Tunnel to update. 848 * @param t Tunnel to update.
847 * @param p Path to use. 849 * @param p Path to use.
@@ -1461,8 +1463,8 @@ send_prebuilt_message (const struct GNUNET_MessageHeader *message,
1461 break; 1463 break;
1462 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN: 1464 case GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN:
1463 to = (struct GNUNET_MESH_ToOrigin *) info->data; 1465 to = (struct GNUNET_MESH_ToOrigin *) info->data;
1464 t->bck_pid++; 1466 t->prev_fc.last_pid_sent++; /* FIXME per hop? */
1465 to->pid = htonl(t->bck_pid); 1467 to->pid = htonl (t->prev_fc.last_pid_sent);
1466 } 1468 }
1467 info->data_len = size; 1469 info->data_len = size;
1468 GNUNET_PEER_resolve (peer, &id); 1470 GNUNET_PEER_resolve (peer, &id);
@@ -2126,18 +2128,18 @@ tunnel_delete_client (struct MeshTunnel *t, const struct MeshClient *c)
2126 tunnel_delete_active_client (t, c); 2128 tunnel_delete_active_client (t, c);
2127} 2129}
2128 2130
2129 2131/* FIXME check initial values */
2130static void 2132static void
2131tunnel_add_client (struct MeshTunnel *t, struct MeshClient *c) 2133tunnel_add_client (struct MeshTunnel *t, struct MeshClient *c)
2132{ 2134{
2133 struct MeshTunnelClientInfo clinfo; 2135 struct MeshTunnelClientInfo clinfo;
2134 2136
2135 GNUNET_array_append (t->clients, t->nclients, c); 2137 GNUNET_array_append (t->clients, t->nclients, c);
2136 clinfo.fwd_ack = t->fwd_pid + 1; 2138 clinfo.fwd_ack = t->prev_fc.last_pid_recv + 1;
2139 clinfo.fwd_pid = t->prev_fc.last_pid_recv;
2137 clinfo.bck_ack = t->nobuffer ? 1 : INITIAL_WINDOW_SIZE - 1; 2140 clinfo.bck_ack = t->nobuffer ? 1 : INITIAL_WINDOW_SIZE - 1;
2138 clinfo.fwd_pid = t->fwd_pid; 2141 clinfo.bck_pid = (uint32_t) -1; /* Expected next: 0 */
2139 clinfo.bck_pid = (uint32_t) -1; // Expected next: 0 2142 t->nclients--; /* Double append */
2140 t->nclients--;
2141 GNUNET_array_append (t->clients_fc, t->nclients, clinfo); 2143 GNUNET_array_append (t->clients_fc, t->nclients, clinfo);
2142} 2144}
2143 2145
@@ -2170,8 +2172,8 @@ tunnel_use_path (struct MeshTunnel *t, struct MeshPeerPath *p)
2170 if (NULL != t->path) 2172 if (NULL != t->path)
2171 path_destroy (t->path); 2173 path_destroy (t->path);
2172 t->path = path_duplicate (p); 2174 t->path = path_duplicate (p);
2173 if (GNUNET_SCHEDULER_NO_TASK == t->path_refresh_task) 2175 if (GNUNET_SCHEDULER_NO_TASK == t->maintenance_task)
2174 t->path_refresh_task = 2176 t->maintenance_task =
2175 GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t); 2177 GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t);
2176} 2178}
2177 2179
@@ -2298,8 +2300,9 @@ tunnel_get_clients_fwd_ack (struct MeshTunnel *t)
2298 } 2300 }
2299 } 2301 }
2300 2302
2301 if (GNUNET_YES == t->nobuffer && GMC_is_pid_bigger(ack, t->fwd_pid)) 2303 if (GNUNET_YES == t->nobuffer &&
2302 ack = (uint32_t) t->fwd_pid + 1; // Might overflow, it's ok. 2304 GMC_is_pid_bigger(ack, t->prev_fc.last_pid_recv))
2305 ack = (uint32_t) t->prev_fc.last_pid_recv + 1; // Might overflow, it's ok.
2303 2306
2304 return (uint32_t) ack; 2307 return (uint32_t) ack;
2305} 2308}
@@ -2317,20 +2320,18 @@ static uint32_t
2317tunnel_get_fwd_ack (struct MeshTunnel *t) 2320tunnel_get_fwd_ack (struct MeshTunnel *t)
2318{ 2321{
2319 uint32_t ack; 2322 uint32_t ack;
2320 uint32_t count;
2321 uint32_t buffer_free; 2323 uint32_t buffer_free;
2322 int64_t client_ack; 2324 int64_t client_ack;
2323 2325
2324 count = t->fwd_pid; 2326 buffer_free = t->queue_max - t->next_fc.queue_n;
2325 buffer_free = t->fwd_queue_max - t->fwd_queue_n;
2326 client_ack = tunnel_get_clients_fwd_ack (t); 2327 client_ack = tunnel_get_clients_fwd_ack (t);
2327 if (GNUNET_YES == t->nobuffer) 2328 if (GNUNET_YES == t->nobuffer)
2328 { 2329 {
2329 ack = count; 2330 ack = t->prev_fc.last_ack_sent;
2330 } 2331 }
2331 else 2332 else
2332 { 2333 {
2333 ack = count + buffer_free; // Overflow? OK! 2334 ack = t->prev_fc.last_ack_sent + buffer_free; // Overflow? OK!
2334 } 2335 }
2335 if (-1LL == client_ack) 2336 if (-1LL == client_ack)
2336 { 2337 {
@@ -2341,7 +2342,7 @@ tunnel_get_fwd_ack (struct MeshTunnel *t)
2341 2342
2342 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2343 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2343 "c %u, bf %u, cl %lld, ACK: %u\n", 2344 "c %u, bf %u, cl %lld, ACK: %u\n",
2344 count, buffer_free, client_ack, ack); 2345 t->prev_fc.last_ack_sent, buffer_free, client_ack, ack);
2345 return ack; 2346 return ack;
2346} 2347}
2347 2348
@@ -2408,14 +2409,14 @@ tunnel_send_client_fwd_ack (struct MeshTunnel *t)
2408 ack = tunnel_get_fwd_ack (t); 2409 ack = tunnel_get_fwd_ack (t);
2409 2410
2410 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ack); 2411 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ack %u\n", ack);
2411 if (t->last_fwd_ack == ack) 2412 if (t->prev_fc.last_ack_sent == ack)
2412 { 2413 {
2413 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " same as last, not sending!\n"); 2414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " same as last, not sending!\n");
2414 return; 2415 return;
2415 } 2416 }
2416 2417
2417 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending!\n"); 2418 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending!\n");
2418 t->last_fwd_ack = ack; 2419 t->prev_fc.last_ack_sent = ack;
2419 send_local_ack (t, t->owner, ack); 2420 send_local_ack (t, t->owner, ack);
2420} 2421}
2421 2422
@@ -2464,31 +2465,29 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2464 } 2465 }
2465 2466
2466 /* Check if we need to transmit the ACK */ 2467 /* Check if we need to transmit the ACK */
2467 if (t->fwd_queue_max > t->fwd_queue_n * 4 && 2468 if (t->queue_max > t->next_fc.queue_n * 4 &&
2468 GMC_is_pid_bigger(t->last_fwd_ack, t->fwd_pid) && 2469 GMC_is_pid_bigger(t->prev_fc.last_ack_sent, t->prev_fc.last_pid_recv) &&
2469 GNUNET_NO == t->force_ack) 2470 GNUNET_NO == t->force_ack)
2470 { 2471 {
2471 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, buffer free\n"); 2472 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not sending ACK, buffer free\n");
2472 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2473 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2473 " t->qmax: %u, t->qn: %u\n", 2474 " t->qmax: %u, t->qn: %u\n",
2474 t->fwd_queue_max, t->fwd_queue_n); 2475 t->queue_max, t->next_fc.queue_n);
2475 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2476 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2476 " t->pid: %u, t->ack: %u\n", 2477 " t->pid: %u, t->ack: %u\n",
2477 t->fwd_pid, t->last_fwd_ack); 2478 t->prev_fc.last_pid_recv, t->prev_fc.last_ack_sent);
2478 return; 2479 return;
2479 } 2480 }
2480 2481
2481 /* Ok, ACK might be necessary, what PID to ACK? */ 2482 /* Ok, ACK might be necessary, what PID to ACK? */
2482 ack = tunnel_get_fwd_ack (t); 2483 ack = tunnel_get_fwd_ack (t);
2483 2484 if (ack == t->prev_fc.last_ack_sent && GNUNET_NO == t->force_ack)
2484 /* If speed_min and not all children have ack'd, dont send yet */
2485 if (ack == t->last_fwd_ack && GNUNET_NO == t->force_ack)
2486 { 2485 {
2487 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not sending FWD ACK, not ready\n"); 2486 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not sending FWD ACK, not ready\n");
2488 return; 2487 return;
2489 } 2488 }
2490 2489
2491 t->last_fwd_ack = ack; 2490 t->prev_fc.last_ack_sent = ack;
2492 send_ack (t, t->prev_hop, ack); 2491 send_ack (t, t->prev_hop, ack);
2493 debug_fwd_ack++; 2492 debug_fwd_ack++;
2494 t->force_ack = GNUNET_NO; 2493 t->force_ack = GNUNET_NO;
@@ -2502,24 +2501,24 @@ tunnel_send_fwd_ack (struct MeshTunnel *t, uint16_t type)
2502 * @param id Id of the child node. 2501 * @param id Id of the child node.
2503 */ 2502 */
2504static void 2503static void
2505tunnel_send_child_bck_ack (struct MeshTunnel *t, 2504tunnel_send_mesh_bck_ack (struct MeshTunnel *t,
2506 GNUNET_PEER_Id peer) 2505 GNUNET_PEER_Id peer)
2507{ 2506{
2508 uint32_t ack = 0; // FIXME 2507 uint32_t ack = 0; // FIXME
2509 2508
2510// ack = cinfo->bck_pid + t->bck_queue_max - t->bck_queue_n; 2509 ack = t->next_fc.last_pid_recv + t->queue_max - t->prev_fc.queue_n;
2511// 2510
2512// if (cinfo->bck_ack == ack && GNUNET_NO == t->force_ack) 2511 if (t->next_fc.last_ack_sent == ack && GNUNET_NO == t->force_ack)
2513// { 2512 {
2514// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2513 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2515// " Not sending ACK, not needed\n"); 2514 " Not sending ACK, not needed\n");
2516// return; 2515 return;
2517// } 2516 }
2518// cinfo->bck_ack = ack; 2517 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2519// 2518 " Sending BCK ACK %u (last sent: %u)\n",
2520// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2519 ack, t->next_fc.last_ack_sent);
2521// " Sending BCK ACK %u (last sent: %u)\n", 2520 t->next_fc.last_ack_sent = ack;
2522// ack, cinfo->bck_ack); 2521
2523 send_ack (t, peer, ack); 2522 send_ack (t, peer, ack);
2524} 2523}
2525 2524
@@ -2547,7 +2546,7 @@ tunnel_send_clients_bck_ack (struct MeshTunnel *t)
2547 2546
2548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Sending BCK ACK to clients\n"); 2547 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Sending BCK ACK to clients\n");
2549 2548
2550 tunnel_delta = t->bck_queue_max - t->bck_queue_n; 2549 tunnel_delta = t->queue_max - t->next_fc.queue_n;
2551 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " tunnel delta: %u\n", tunnel_delta); 2550 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " tunnel delta: %u\n", tunnel_delta);
2552 2551
2553 /* Find client whom to allow to send to origin (with lowest buffer space) */ 2552 /* Find client whom to allow to send to origin (with lowest buffer space) */
@@ -2623,7 +2622,7 @@ tunnel_send_bck_ack (struct MeshTunnel *t, uint16_t type)
2623 } 2622 }
2624 2623
2625 tunnel_send_clients_bck_ack (t); 2624 tunnel_send_clients_bck_ack (t);
2626 tunnel_send_child_bck_ack (t, t->next_hop); 2625 tunnel_send_mesh_bck_ack (t, t->next_hop);
2627 t->force_ack = GNUNET_NO; 2626 t->force_ack = GNUNET_NO;
2628} 2627}
2629 2628
@@ -2831,10 +2830,8 @@ tunnel_destroy (struct MeshTunnel *t)
2831 peer_cancel_queues (t->next_hop, t); 2830 peer_cancel_queues (t->next_hop, t);
2832 peer_cancel_queues (t->prev_hop, t); 2831 peer_cancel_queues (t->prev_hop, t);
2833 2832
2834 if (GNUNET_SCHEDULER_NO_TASK != t->timeout_task) 2833 if (GNUNET_SCHEDULER_NO_TASK != t->maintenance_task)
2835 GNUNET_SCHEDULER_cancel (t->timeout_task); 2834 GNUNET_SCHEDULER_cancel (t->maintenance_task);
2836 if (GNUNET_SCHEDULER_NO_TASK != t->path_refresh_task)
2837 GNUNET_SCHEDULER_cancel (t->path_refresh_task);
2838 2835
2839 n_tunnels--; 2836 n_tunnels--;
2840 GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO); 2837 GNUNET_STATISTICS_update (stats, "# tunnels", -1, GNUNET_NO);
@@ -2941,13 +2938,16 @@ tunnel_new (GNUNET_PEER_Id owner,
2941 t = GNUNET_malloc (sizeof (struct MeshTunnel)); 2938 t = GNUNET_malloc (sizeof (struct MeshTunnel));
2942 t->id.oid = owner; 2939 t->id.oid = owner;
2943 t->id.tid = tid; 2940 t->id.tid = tid;
2944 t->fwd_queue_max = (max_msgs_queue / max_tunnels) + 1; 2941 t->queue_max = (max_msgs_queue / max_tunnels) + 1;
2945 t->bck_queue_max = t->fwd_queue_max;
2946 t->owner = client; 2942 t->owner = client;
2947 t->fwd_pid = (uint32_t) -1; // Next (expected) = 0 2943 t->next_fc.last_pid_sent = (uint32_t) -1; /* Next (expected) = 0 */
2948 t->bck_pid = (uint32_t) -1; // Next (expected) = 0 2944 t->next_fc.last_pid_recv = (uint32_t) -1;
2949 t->bck_ack = INITIAL_WINDOW_SIZE - 1; 2945 t->prev_fc.last_pid_sent = (uint32_t) -1;
2950 t->last_fwd_ack = INITIAL_WINDOW_SIZE - 1; 2946 t->prev_fc.last_pid_recv = (uint32_t) -1;
2947 t->next_fc.last_ack_sent = INITIAL_WINDOW_SIZE - 1;
2948 t->next_fc.last_ack_recv = INITIAL_WINDOW_SIZE - 1;
2949 t->prev_fc.last_ack_sent = INITIAL_WINDOW_SIZE - 1;
2950 t->prev_fc.last_ack_recv = INITIAL_WINDOW_SIZE - 1;
2951 t->local_tid = local; 2951 t->local_tid = local;
2952 n_tunnels++; 2952 n_tunnels++;
2953 GNUNET_STATISTICS_update (stats, "# tunnels", 1, GNUNET_NO); 2953 GNUNET_STATISTICS_update (stats, "# tunnels", 1, GNUNET_NO);
@@ -3035,7 +3035,7 @@ tunnel_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3035 struct MeshTunnel *t = cls; 3035 struct MeshTunnel *t = cls;
3036 struct GNUNET_PeerIdentity id; 3036 struct GNUNET_PeerIdentity id;
3037 3037
3038 t->timeout_task = GNUNET_SCHEDULER_NO_TASK; 3038 t->maintenance_task = GNUNET_SCHEDULER_NO_TASK;
3039 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 3039 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
3040 return; 3040 return;
3041 GNUNET_PEER_resolve(t->id.oid, &id); 3041 GNUNET_PEER_resolve(t->id.oid, &id);
@@ -3056,9 +3056,9 @@ tunnel_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3056static void 3056static void
3057tunnel_reset_timeout (struct MeshTunnel *t) 3057tunnel_reset_timeout (struct MeshTunnel *t)
3058{ 3058{
3059 if (GNUNET_SCHEDULER_NO_TASK != t->timeout_task) 3059 if (GNUNET_SCHEDULER_NO_TASK != t->maintenance_task)
3060 GNUNET_SCHEDULER_cancel (t->timeout_task); 3060 GNUNET_SCHEDULER_cancel (t->maintenance_task);
3061 t->timeout_task = 3061 t->maintenance_task =
3062 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 3062 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
3063 (refresh_path_time, 4), &tunnel_timeout, t); 3063 (refresh_path_time, 4), &tunnel_timeout, t);
3064} 3064}
@@ -3356,15 +3356,17 @@ queue_send (void *cls, size_t size, void *buf)
3356 t->pending_messages--; 3356 t->pending_messages--;
3357 if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == queue->type) 3357 if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == queue->type)
3358 { 3358 {
3359 t->fwd_queue_n--; 3359 t->next_fc.queue_n--;
3360 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3360 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3361 "********* unicast: t->q (%u/%u)\n", 3361 "********* unicast: t->q (%u/%u)\n",
3362 t->fwd_queue_n, t->fwd_queue_max); 3362 t->next_fc.queue_n, t->queue_max);
3363 } 3363 }
3364 else if (GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == queue->type) 3364 else if (GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == queue->type)
3365 { 3365 {
3366 t->bck_queue_n--; 3366 t->prev_fc.queue_n--;
3367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* to origin\n"); 3367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3368 "********* to orig: t->q (%u/%u)\n",
3369 t->prev_fc.queue_n, t->queue_max);
3368 } 3370 }
3369 3371
3370 /* Fill buf */ 3372 /* Fill buf */
@@ -3451,7 +3453,7 @@ queue_send (void *cls, size_t size, void *buf)
3451 } 3453 }
3452 3454
3453 /* If more data in queue, send next */ 3455 /* If more data in queue, send next */
3454 queue = queue_get_next(peer); 3456 queue = queue_get_next (peer);
3455 if (NULL != queue) 3457 if (NULL != queue)
3456 { 3458 {
3457 struct GNUNET_PeerIdentity id; 3459 struct GNUNET_PeerIdentity id;
@@ -3513,23 +3515,20 @@ queue_add (void *cls, uint16_t type, size_t size,
3513{ 3515{
3514 struct MeshPeerQueue *queue; 3516 struct MeshPeerQueue *queue;
3515 struct GNUNET_PeerIdentity id; 3517 struct GNUNET_PeerIdentity id;
3516 unsigned int *max;
3517 unsigned int *n; 3518 unsigned int *n;
3518 3519
3519 n = NULL; 3520 n = NULL;
3520 if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == type) 3521 if (GNUNET_MESSAGE_TYPE_MESH_UNICAST == type)
3521 { 3522 {
3522 n = &t->fwd_queue_n; 3523 n = &t->next_fc.queue_n;
3523 max = &t->fwd_queue_max;
3524 } 3524 }
3525 else if (GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == type) 3525 else if (GNUNET_MESSAGE_TYPE_MESH_TO_ORIGIN == type)
3526 { 3526 {
3527 n = &t->bck_queue_n; 3527 n = &t->prev_fc.queue_n;
3528 max = &t->bck_queue_max;
3529 } 3528 }
3530 if (NULL != n) 3529 if (NULL != n)
3531 { 3530 {
3532 if (*n >= *max) 3531 if (*n >= t->queue_max)
3533 { 3532 {
3534 GNUNET_break(0); 3533 GNUNET_break(0);
3535 GNUNET_STATISTICS_update(stats, 3534 GNUNET_STATISTICS_update(stats,
@@ -3639,14 +3638,13 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
3639 if (0 != (opt & MESH_TUNNEL_OPT_NOBUFFER)) 3638 if (0 != (opt & MESH_TUNNEL_OPT_NOBUFFER))
3640 { 3639 {
3641 t->nobuffer = GNUNET_YES; 3640 t->nobuffer = GNUNET_YES;
3642 t->last_fwd_ack = t->fwd_pid + 1; 3641 t->prev_fc.last_ack_sent = t->prev_fc.last_pid_recv + 1;
3643 } 3642 }
3644 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " nobuffer:%d\n", t->nobuffer); 3643 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " nobuffer:%d\n", t->nobuffer);
3645 3644
3646 if (GNUNET_YES == t->nobuffer) 3645 if (GNUNET_YES == t->nobuffer)
3647 { 3646 {
3648 t->bck_queue_max = 1; 3647 t->queue_max = 1;
3649 t->fwd_queue_max = 1;
3650 } 3648 }
3651 3649
3652 // FIXME only assign a local tid if a local client is interested (on demand) 3650 // FIXME only assign a local tid if a local client is interested (on demand)
@@ -3718,7 +3716,7 @@ handle_mesh_path_create (void *cls, const struct GNUNET_PeerIdentity *peer,
3718 /* It is for us! Send ack. */ 3716 /* It is for us! Send ack. */
3719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n"); 3717 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " It's for us!\n");
3720 peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO); 3718 peer_info_add_path_to_origin (orig_peer_info, path, GNUNET_NO);
3721 t->peer = path->peers[0]; 3719 t->dest = myid;
3722 send_path_ack (t); 3720 send_path_ack (t);
3723 } 3721 }
3724 else 3722 else
@@ -3931,7 +3929,6 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
3931{ 3929{
3932 struct GNUNET_MESH_Unicast *msg; 3930 struct GNUNET_MESH_Unicast *msg;
3933 struct MeshTunnel *t; 3931 struct MeshTunnel *t;
3934 GNUNET_PEER_Id dest_id;
3935 uint32_t pid; 3932 uint32_t pid;
3936 uint32_t ttl; 3933 uint32_t ttl;
3937 size_t size; 3934 size_t size;
@@ -3960,7 +3957,7 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
3960 return GNUNET_OK; 3957 return GNUNET_OK;
3961 } 3958 }
3962 pid = ntohl (msg->pid); 3959 pid = ntohl (msg->pid);
3963 if (t->fwd_pid == pid) 3960 if (t->prev_fc.last_pid_recv == pid)
3964 { 3961 {
3965 GNUNET_STATISTICS_update (stats, "# duplicate PID drops", 1, GNUNET_NO); 3962 GNUNET_STATISTICS_update (stats, "# duplicate PID drops", 1, GNUNET_NO);
3966 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3963 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -3973,21 +3970,20 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
3973 " pid %u not seen yet, forwarding\n", pid); 3970 " pid %u not seen yet, forwarding\n", pid);
3974 } 3971 }
3975 3972
3976 t->fwd_pid = pid; 3973 t->prev_fc.last_pid_recv = pid;
3977 3974
3978 if (GMC_is_pid_bigger (pid, t->last_fwd_ack)) 3975 if (GMC_is_pid_bigger (pid, t->prev_fc.last_ack_sent))
3979 { 3976 {
3980 GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO); 3977 GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO);
3981 GNUNET_break_op (0); 3978 GNUNET_break_op (0);
3982 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3979 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3983 "Received PID %u, ACK %u\n", 3980 "Received PID %u, ACK %u\n",
3984 pid, t->last_fwd_ack); 3981 pid, t->prev_fc.last_ack_sent);
3985 return GNUNET_OK; 3982 return GNUNET_OK;
3986 } 3983 }
3987 3984
3988 tunnel_reset_timeout (t); 3985 tunnel_reset_timeout (t);
3989 dest_id = t->peer; 3986 if (t->dest == myid)
3990 if (dest_id == myid)
3991 { 3987 {
3992 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3988 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3993 " it's for us! sending to clients...\n"); 3989 " it's for us! sending to clients...\n");
@@ -4008,16 +4004,15 @@ handle_mesh_data_unicast (void *cls, const struct GNUNET_PeerIdentity *peer,
4008 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4004 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4009 " not for us, retransmitting...\n"); 4005 " not for us, retransmitting...\n");
4010 4006
4011/* cinfo->fwd_pid = pid; FIXME
4012
4013 if (GNUNET_YES == t->nobuffer && 4007 if (GNUNET_YES == t->nobuffer &&
4014 GNUNET_YES == GMC_is_pid_bigger (pid, cinfo->fwd_ack)) 4008 GNUNET_YES == GMC_is_pid_bigger (pid, t->next_fc.last_ack_recv))
4015 { 4009 {
4016 GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO); 4010 GNUNET_STATISTICS_update (stats, "# unsolicited unicast", 1, GNUNET_NO);
4017 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " %u > %u\n", pid, cinfo->fwd_ack); 4011 GNUNET_log (GNUNET_ERROR_TYPE_INFO, " %u > %u\n",
4012 pid, t->next_fc.last_ack_recv);
4018 GNUNET_break_op (0); 4013 GNUNET_break_op (0);
4019 return GNUNET_OK; 4014 return GNUNET_OK;
4020 }*/ 4015 }
4021 send_prebuilt_message (message, t->next_hop, t); 4016 send_prebuilt_message (message, t->next_hop, t);
4022 GNUNET_STATISTICS_update (stats, "# unicast forwarded", 1, GNUNET_NO); 4017 GNUNET_STATISTICS_update (stats, "# unicast forwarded", 1, GNUNET_NO);
4023 return GNUNET_OK; 4018 return GNUNET_OK;
@@ -4070,19 +4065,19 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
4070 } 4065 }
4071 4066
4072 4067
4073// if (cinfo->bck_pid == pid) FIXME 4068 if (t->next_fc.last_pid_recv == pid)
4074// { 4069 {
4075// /* already seen this packet, drop */ 4070 /* already seen this packet, drop */
4076// GNUNET_STATISTICS_update (stats, "# duplicate PID drops BCK", 1, GNUNET_NO); 4071 GNUNET_STATISTICS_update (stats, "# duplicate PID drops BCK", 1, GNUNET_NO);
4077// GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4072 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4078// " Already seen pid %u, DROPPING!\n", pid); 4073 " Already seen pid %u, DROPPING!\n", pid);
4079// tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK); 4074 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK);
4080// return GNUNET_OK; 4075 return GNUNET_OK;
4081// } 4076 }
4082 4077
4083 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4078 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4084 " pid %u not seen yet, forwarding\n", pid); 4079 " pid %u not seen yet, forwarding\n", pid);
4085// cinfo->bck_pid = pid; FIXME 4080 t->next_fc.last_pid_recv = pid;
4086 4081
4087 if (NULL != t->owner) 4082 if (NULL != t->owner)
4088 { 4083 {
@@ -4095,8 +4090,6 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
4095 memcpy (cbuf, message, size); 4090 memcpy (cbuf, message, size);
4096 copy = (struct GNUNET_MESH_ToOrigin *) cbuf; 4091 copy = (struct GNUNET_MESH_ToOrigin *) cbuf;
4097 copy->tid = htonl (t->local_tid); 4092 copy->tid = htonl (t->local_tid);
4098 t->bck_pid++;
4099 copy->pid = htonl (t->bck_pid);
4100 GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO); 4093 GNUNET_STATISTICS_update (stats, "# to origin received", 1, GNUNET_NO);
4101 GNUNET_SERVER_notification_context_unicast (nc, t->owner->handle, 4094 GNUNET_SERVER_notification_context_unicast (nc, t->owner->handle,
4102 &copy->header, GNUNET_NO); 4095 &copy->header, GNUNET_NO);
@@ -4113,7 +4106,7 @@ handle_mesh_data_to_orig (void *cls, const struct GNUNET_PeerIdentity *peer,
4113 GNUNET_break (0); 4106 GNUNET_break (0);
4114 return GNUNET_OK; 4107 return GNUNET_OK;
4115 } 4108 }
4116 if (0 == t->prev_hop) 4109 if (0 == t->prev_hop) /* No owner AND no prev hop */
4117 { 4110 {
4118 if (GNUNET_YES == t->destroy) 4111 if (GNUNET_YES == t->destroy)
4119 { 4112 {
@@ -4174,12 +4167,11 @@ handle_mesh_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
4174 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ACK %u\n", ack); 4167 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " ACK %u\n", ack);
4175 4168
4176 /* Is this a forward or backward ACK? */ 4169 /* Is this a forward or backward ACK? */
4177 if (t->prev_hop != GNUNET_PEER_search(peer)) 4170 if (t->prev_hop != GNUNET_PEER_search (peer))
4178 { 4171 {
4179
4180 debug_bck_ack++; 4172 debug_bck_ack++;
4181 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n"); 4173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " FWD ACK\n");
4182// cinfo->fwd_ack = ack; FIXME 4174 t->next_fc.last_ack_recv = ack;
4183 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK); 4175 tunnel_send_fwd_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK);
4184 peer_unlock_queue (t->next_hop); 4176 peer_unlock_queue (t->next_hop);
4185// if (GNUNET_SCHEDULER_NO_TASK != cinfo->fc_poll) FIXME 4177// if (GNUNET_SCHEDULER_NO_TASK != cinfo->fc_poll) FIXME
@@ -4192,7 +4184,7 @@ handle_mesh_ack (void *cls, const struct GNUNET_PeerIdentity *peer,
4192 else 4184 else
4193 { 4185 {
4194 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n"); 4186 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " BCK ACK\n");
4195 t->bck_ack = ack; 4187 t->prev_fc.last_ack_recv = ack;
4196 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK); 4188 tunnel_send_bck_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK);
4197 peer_unlock_queue (t->prev_hop); 4189 peer_unlock_queue (t->prev_hop);
4198 } 4190 }
@@ -4449,7 +4441,7 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
4449 size_t size = sizeof (struct GNUNET_MESH_TunnelKeepAlive); 4441 size_t size = sizeof (struct GNUNET_MESH_TunnelKeepAlive);
4450 char cbuf[size]; 4442 char cbuf[size];
4451 4443
4452 t->path_refresh_task = GNUNET_SCHEDULER_NO_TASK; 4444 t->maintenance_task = GNUNET_SCHEDULER_NO_TASK;
4453 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 4445 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
4454 { 4446 {
4455 return; 4447 return;
@@ -4466,7 +4458,7 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
4466 msg->tid = htonl (t->id.tid); 4458 msg->tid = htonl (t->id.tid);
4467 send_prebuilt_message (&msg->header, t->next_hop, t); 4459 send_prebuilt_message (&msg->header, t->next_hop, t);
4468 4460
4469 t->path_refresh_task = 4461 t->maintenance_task =
4470 GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t); 4462 GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t);
4471 tunnel_reset_timeout (t); 4463 tunnel_reset_timeout (t);
4472} 4464}
@@ -4792,7 +4784,7 @@ handle_local_tunnel_destroy (void *cls, struct GNUNET_SERVER_Client *client,
4792 /* Don't try to ACK the client about the tunnel_destroy multicast packet */ 4784 /* Don't try to ACK the client about the tunnel_destroy multicast packet */
4793 t->owner = NULL; 4785 t->owner = NULL;
4794 tunnel_send_destroy (t); 4786 tunnel_send_destroy (t);
4795 peer_remove_tunnel (peer_get_short(t->peer), t); 4787 peer_remove_tunnel (peer_get_short(t->dest), t);
4796 t->destroy = GNUNET_YES; 4788 t->destroy = GNUNET_YES;
4797 /* The tunnel will be destroyed when the last message is transmitted. */ 4789 /* The tunnel will be destroyed when the last message is transmitted. */
4798 GNUNET_SERVER_receive_done (client, GNUNET_OK); 4790 GNUNET_SERVER_receive_done (client, GNUNET_OK);
@@ -4916,13 +4908,13 @@ handle_local_unicast (void *cls, struct GNUNET_SERVER_Client *client,
4916 return; 4908 return;
4917 } 4909 }
4918 4910
4919 /* PID should be as expected */ 4911 /* PID should be as expected: client<->service communication */
4920 if (ntohl (data_msg->pid) != t->fwd_pid + 1) 4912 if (ntohl (data_msg->pid) != t->prev_fc.last_pid_recv + 1)
4921 { 4913 {
4922 GNUNET_break (0); 4914 GNUNET_break (0);
4923 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 4915 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
4924 "Unicast PID, expected %u, got %u\n", 4916 "Unicast PID, expected %u, got %u\n",
4925 t->fwd_pid + 1, ntohl (data_msg->pid)); 4917 t->prev_fc.last_pid_recv + 1, ntohl (data_msg->pid));
4926 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 4918 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
4927 return; 4919 return;
4928 } 4920 }
@@ -5040,13 +5032,13 @@ handle_local_to_origin (void *cls, struct GNUNET_SERVER_Client *client,
5040 char buf[ntohs (message->size)] GNUNET_ALIGN; 5032 char buf[ntohs (message->size)] GNUNET_ALIGN;
5041 struct GNUNET_MESH_ToOrigin *copy; 5033 struct GNUNET_MESH_ToOrigin *copy;
5042 5034
5043 /* Work around const limitation */ 5035 /* Work around 'const' limitation */
5044 copy = (struct GNUNET_MESH_ToOrigin *) buf; 5036 copy = (struct GNUNET_MESH_ToOrigin *) buf;
5045 memcpy (buf, data_msg, size); 5037 memcpy (buf, data_msg, size);
5046 GNUNET_PEER_resolve (t->id.oid, &copy->oid); 5038 GNUNET_PEER_resolve (t->id.oid, &copy->oid);
5047 copy->tid = htonl (t->id.tid); 5039 copy->tid = htonl (t->id.tid);
5048 copy->ttl = htonl (default_ttl); 5040 copy->ttl = htonl (default_ttl);
5049 copy->pid = htonl (t->bck_pid + 1); 5041 copy->pid = htonl (t->prev_fc.last_pid_sent + 1);
5050 5042
5051 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5043 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5052 " calling generic handler...\n"); 5044 " calling generic handler...\n");
@@ -5107,7 +5099,7 @@ handle_local_ack (void *cls, struct GNUNET_SERVER_Client *client,
5107 if (NULL != t->owner && t->owner->handle == client) 5099 if (NULL != t->owner && t->owner->handle == client)
5108 { 5100 {
5109 /* The client owns the tunnel, ACK is for data to_origin, send BCK ACK. */ 5101 /* The client owns the tunnel, ACK is for data to_origin, send BCK ACK. */
5110 t->bck_ack = ack; 5102 t->next_fc.last_ack_sent = ack;
5111 tunnel_send_bck_ack(t, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK); 5103 tunnel_send_bck_ack(t, GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK);
5112 } 5104 }
5113 else 5105 else
@@ -5147,7 +5139,7 @@ monitor_all_tunnels_iterator (void *cls,
5147 msg->tunnel_id = htonl (t->id.tid); 5139 msg->tunnel_id = htonl (t->id.tid);
5148 msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); 5140 msg->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor));
5149 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS); 5141 msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_TUNNELS);
5150 GNUNET_PEER_resolve (t->peer, &msg->destination); 5142 GNUNET_PEER_resolve (t->dest, &msg->destination);
5151 5143
5152 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 5144 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
5153 "* sending info about tunnel %s [%u]\n", 5145 "* sending info about tunnel %s [%u]\n",
@@ -5240,7 +5232,7 @@ handle_local_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
5240 /* Initialize context */ 5232 /* Initialize context */
5241 resp = GNUNET_malloc (sizeof (struct GNUNET_MESH_LocalMonitor)); 5233 resp = GNUNET_malloc (sizeof (struct GNUNET_MESH_LocalMonitor));
5242 *resp = *msg; 5234 *resp = *msg;
5243 GNUNET_PEER_resolve (t->peer, &resp->destination); 5235 GNUNET_PEER_resolve (t->dest, &resp->destination);
5244 resp->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor)); 5236 resp->header.size = htons (sizeof (struct GNUNET_MESH_LocalMonitor));
5245 GNUNET_SERVER_notification_context_unicast (nc, c->handle, 5237 GNUNET_SERVER_notification_context_unicast (nc, c->handle,
5246 &resp->header, GNUNET_NO); 5238 &resp->header, GNUNET_NO);