aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-10-30 13:48:43 +0000
committerBart Polot <bart@net.in.tum.de>2012-10-30 13:48:43 +0000
commitf4b7eb1607fc0f7a03088a1da028c0b8e7ef3633 (patch)
tree1872a86ed75c1930014a77599f54b6f8533b4aeb
parentf178c3703d74f97133e6028ae43a01284b48f3ae (diff)
downloadgnunet-f4b7eb1607fc0f7a03088a1da028c0b8e7ef3633.tar.gz
gnunet-f4b7eb1607fc0f7a03088a1da028c0b8e7ef3633.zip
- unify client/child data structure
-rw-r--r--src/mesh/gnunet-service-mesh-new.c57
1 files changed, 19 insertions, 38 deletions
diff --git a/src/mesh/gnunet-service-mesh-new.c b/src/mesh/gnunet-service-mesh-new.c
index 5cc0d8c0d..37038177a 100644
--- a/src/mesh/gnunet-service-mesh-new.c
+++ b/src/mesh/gnunet-service-mesh-new.c
@@ -508,14 +508,20 @@ struct MeshTunnel
508 508
509 509
510/** 510/**
511 * Info about a child node in a tunnel, needed to perform flow control. 511 * Flow control info about a node in a tunnel. The node can be a local client
512 * or a remote peer.
512 */ 513 */
513struct MeshTunnelChildInfo 514struct MeshTunnelFlowControlInfo
514{ 515{
515 /** 516 /**
516 * ID of the child node. 517 * Peer info of the node, NULL if local client.
517 */ 518 */
518 GNUNET_PEER_Id id; 519 struct MeshPeerInfo *peer;
520
521 /**
522 * Client info of the node, NULL if remote peer.
523 */
524 struct MeshClient *client;
519 525
520 /** 526 /**
521 * SKIP value. 527 * SKIP value.
@@ -523,28 +529,28 @@ struct MeshTunnelChildInfo
523 uint32_t skip; 529 uint32_t skip;
524 530
525 /** 531 /**
526 * Last sent PID. 532 * Last PID sent.
527 */ 533 */
528 uint32_t fwd_pid; 534 uint32_t fwd_pid;
529 535
530 /** 536 /**
531 * Last received PID. 537 * Last PID received.
532 */ 538 */
533 uint32_t bck_pid; 539 uint32_t bck_pid;
534 540
535 /** 541 /**
536 * Maximum PID allowed (FWD ACK received). 542 * Maximum PID they allowed us to send (FWD ACK received).
537 */ 543 */
538 uint32_t fwd_ack; 544 uint32_t fwd_ack;
539 545
540 /** 546 /**
541 * Last ACK sent to that child (BCK ACK). 547 * Maximum PID we allowed them to send (BCK ACK sent).
542 */ 548 */
543 uint32_t bck_ack; 549 uint32_t bck_ack;
544 550
545 /** 551 /**
546 * Circular buffer pointing to MeshPeerQueue elements for all 552 * Circular buffer pointing to MeshPeerQueue elements for all
547 * payload traffic going to this child. 553 * payload traffic going to this node.
548 * Size determined by the tunnel queue size (@c t->fwd_queue_max). 554 * Size determined by the tunnel queue size (@c t->fwd_queue_max).
549 */ 555 */
550 struct MeshPeerQueue **send_buffer; 556 struct MeshPeerQueue **send_buffer;
@@ -572,34 +578,6 @@ struct MeshTunnelChildInfo
572 578
573 579
574/** 580/**
575 * Info about a leaf client of a tunnel, needed to perform flow control.
576 */
577struct MeshTunnelClientInfo
578{
579 /**
580 * PID of the last packet sent to the client (FWD).
581 */
582 uint32_t fwd_pid;
583
584 /**
585 * PID of the last packet received from the client (BCK).
586 */
587 uint32_t bck_pid;
588
589 /**
590 * Maximum PID allowed (FWD ACK received).
591 */
592 uint32_t fwd_ack;
593
594 /**
595 * Last ACK sent to that child (BCK ACK).
596 */
597 uint32_t bck_ack;
598};
599
600
601
602/**
603 * Info collected during iteration of child nodes in order to get the ACK value 581 * Info collected during iteration of child nodes in order to get the ACK value
604 * for a tunnel. 582 * for a tunnel.
605 */ 583 */
@@ -6733,10 +6711,13 @@ handle_local_announce_regex (void *cls, struct GNUNET_SERVER_Client *client,
6733 msg = (struct GNUNET_MESH_RegexAnnounce *) message; 6711 msg = (struct GNUNET_MESH_RegexAnnounce *) message;
6734 len = ntohs (message->size) - sizeof(struct GNUNET_MESH_RegexAnnounce); 6712 len = ntohs (message->size) - sizeof(struct GNUNET_MESH_RegexAnnounce);
6735 regex = GNUNET_malloc (len + 1); 6713 regex = GNUNET_malloc (len + 1);
6736 memcpy (regex, &message[1], len); 6714 memcpy (regex, &msg[1], len);
6737 regex[len] = '\0'; 6715 regex[len] = '\0';
6738 rd.regex = regex; 6716 rd.regex = regex;
6739 rd.compression = ntohs (msg->compression_characters); 6717 rd.compression = ntohs (msg->compression_characters);
6718 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " length %u\n", len);
6719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " regex %s\n", regex);
6720 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " cm %u\n", ntohs(rd.compression));
6740 GNUNET_array_append (c->regexes, c->n_regex, rd); 6721 GNUNET_array_append (c->regexes, c->n_regex, rd);
6741 if (GNUNET_SCHEDULER_NO_TASK == c->regex_announce_task) 6722 if (GNUNET_SCHEDULER_NO_TASK == c->regex_announce_task)
6742 { 6723 {