aboutsummaryrefslogtreecommitdiff
path: root/src/mesh/gnunet-service-mesh_local.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-10-11 09:33:36 +0000
committerBart Polot <bart@net.in.tum.de>2013-10-11 09:33:36 +0000
commitd254743f5668e69b13b0d82b373699562f3a0738 (patch)
tree5e86150433fe8041547361c04c4791076a620242 /src/mesh/gnunet-service-mesh_local.c
parent393dcdaaa4739e764eecb5ba55ef96edcf1061dd (diff)
downloadgnunet-d254743f5668e69b13b0d82b373699562f3a0738.tar.gz
gnunet-d254743f5668e69b13b0d82b373699562f3a0738.zip
- sync
Diffstat (limited to 'src/mesh/gnunet-service-mesh_local.c')
-rw-r--r--src/mesh/gnunet-service-mesh_local.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/src/mesh/gnunet-service-mesh_local.c b/src/mesh/gnunet-service-mesh_local.c
index 2d6214d3e..eba5b88de 100644
--- a/src/mesh/gnunet-service-mesh_local.c
+++ b/src/mesh/gnunet-service-mesh_local.c
@@ -521,7 +521,7 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client,
521 "Got data from a client!\n"); 521 "Got data from a client!\n");
522 522
523 /* Sanity check for client registration */ 523 /* Sanity check for client registration */
524 if (NULL == (c = client_get (client))) 524 if (NULL == (c = GML_client_get (client)))
525 { 525 {
526 GNUNET_break (0); 526 GNUNET_break (0);
527 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 527 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -543,7 +543,7 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client,
543 /* Channel exists? */ 543 /* Channel exists? */
544 chid = ntohl (msg->id); 544 chid = ntohl (msg->id);
545 fwd = chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; 545 fwd = chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
546 ch = channel_get_by_local_id (c, chid); 546 ch = GML_channel_get (c, chid);
547 if (NULL == ch) 547 if (NULL == ch)
548 { 548 {
549 GNUNET_break (0); 549 GNUNET_break (0);
@@ -551,20 +551,6 @@ handle_data (void *cls, struct GNUNET_SERVER_Client *client,
551 return; 551 return;
552 } 552 }
553 553
554 /* Is the client in the channel? */
555 if ( !( (fwd &&
556 ch->root &&
557 ch->root->handle == client)
558 ||
559 (!fwd &&
560 ch->dest &&
561 ch->dest->handle == client) ) )
562 {
563 GNUNET_break (0);
564 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
565 return;
566 }
567
568 rel = fwd ? ch->root_rel : ch->dest_rel; 554 rel = fwd ? ch->root_rel : ch->dest_rel;
569 rel->client_ready = GNUNET_NO; 555 rel->client_ready = GNUNET_NO;
570 556
@@ -608,7 +594,6 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
608 const struct GNUNET_MessageHeader *message) 594 const struct GNUNET_MessageHeader *message)
609{ 595{
610 struct GNUNET_MESH_LocalAck *msg; 596 struct GNUNET_MESH_LocalAck *msg;
611 struct MeshChannelReliability *rel;
612 struct MeshChannel *ch; 597 struct MeshChannel *ch;
613 struct MeshClient *c; 598 struct MeshClient *c;
614 MESH_ChannelNumber chid; 599 MESH_ChannelNumber chid;
@@ -617,7 +602,7 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
617 LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a local ACK\n"); 602 LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a local ACK\n");
618 603
619 /* Sanity check for client registration */ 604 /* Sanity check for client registration */
620 if (NULL == (c = client_get (client))) 605 if (NULL == (c = GML_client_get (client)))
621 { 606 {
622 GNUNET_break (0); 607 GNUNET_break (0);
623 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 608 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -630,7 +615,7 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
630 /* Channel exists? */ 615 /* Channel exists? */
631 chid = ntohl (msg->channel_id); 616 chid = ntohl (msg->channel_id);
632 LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid); 617 LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid);
633 ch = channel_get_by_local_id (c, chid); 618 ch = GML_channel_get (c, chid);
634 LOG (GNUNET_ERROR_TYPE_DEBUG, " -- ch %p\n", ch); 619 LOG (GNUNET_ERROR_TYPE_DEBUG, " -- ch %p\n", ch);
635 if (NULL == ch) 620 if (NULL == ch)
636 { 621 {
@@ -644,13 +629,9 @@ handle_ack (void *cls, struct GNUNET_SERVER_Client *client,
644 /* If client is root, the ACK is going FWD, therefore this is "BCK". */ 629 /* If client is root, the ACK is going FWD, therefore this is "BCK". */
645 /* If client is dest, the ACK is going BCK, therefore this is "FWD" */ 630 /* If client is dest, the ACK is going BCK, therefore this is "FWD" */
646 fwd = chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV; 631 fwd = chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
647 rel = fwd ? ch->dest_rel : ch->root_rel;
648
649 rel->client_ready = GNUNET_YES;
650 channel_send_client_buffered_data (ch, c, fwd);
651 send_ack (NULL, ch, fwd);
652 632
653 GNUNET_SERVER_receive_done (client, GNUNET_OK); 633 GNUNET_SERVER_receive_done (client, GNUNET_OK);
634 GMCH_handle_local_ack (ch, fwd);
654 635
655 return; 636 return;
656} 637}
@@ -703,7 +684,7 @@ handle_get_tunnels (void *cls, struct GNUNET_SERVER_Client *client,
703 struct MeshClient *c; 684 struct MeshClient *c;
704 685
705 /* Sanity check for client registration */ 686 /* Sanity check for client registration */
706 if (NULL == (c = client_get (client))) 687 if (NULL == (c = GML_client_get (client)))
707 { 688 {
708 GNUNET_break (0); 689 GNUNET_break (0);
709 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 690 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -740,7 +721,7 @@ handle_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client,
740 struct MeshChannel *ch; 721 struct MeshChannel *ch;
741 722
742 /* Sanity check for client registration */ 723 /* Sanity check for client registration */
743 if (NULL == (c = client_get (client))) 724 if (NULL == (c = GML_client_get (client)))
744 { 725 {
745 GNUNET_break (0); 726 GNUNET_break (0);
746 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 727 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);