aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-10 00:00:56 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-10 00:00:56 +0000
commite649f10af79eb62bdd1eb0d358538779e3f49235 (patch)
tree8a0a2e77305018be8dd5c85027018da09d569b2a /src/transport
parent98d966344028d236cc1296ec1fcedb8891774604 (diff)
downloadgnunet-e649f10af79eb62bdd1eb0d358538779e3f49235.tar.gz
gnunet-e649f10af79eb62bdd1eb0d358538779e3f49235.zip
-fix
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_clients.c16
-rw-r--r--src/transport/transport_api.c39
2 files changed, 21 insertions, 34 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index cea1dc14e..db863ae65 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -646,22 +646,12 @@ clients_handle_start (void *cls,
646 tc = setup_client (client); 646 tc = setup_client (client);
647 tc->send_payload = (0 != (2 & options)); 647 tc->send_payload = (0 != (2 & options));
648 hello = GST_hello_get (); 648 hello = GST_hello_get ();
649 if (NULL == hello) 649 if (NULL != hello)
650 {
651 /* We are during startup and should have no neighbours, hence
652 iteration with NULL must work. The HELLO will be sent to
653 all clients once it has been created, so this should happen
654 next anyway, and certainly before we get neighbours. */
655 GST_neighbours_iterate (NULL, NULL);
656 }
657 else
658 {
659 unicast (tc, 650 unicast (tc,
660 hello, 651 hello,
661 GNUNET_NO); 652 GNUNET_NO);
662 GST_neighbours_iterate (&notify_client_about_neighbour, 653 GST_neighbours_iterate (&notify_client_about_neighbour,
663 tc); 654 tc);
664 }
665 GNUNET_SERVER_receive_done (client, 655 GNUNET_SERVER_receive_done (client,
666 GNUNET_OK); 656 GNUNET_OK);
667} 657}
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 2da6e9a54..d672b4d46 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -689,8 +689,8 @@ demultiplexer (void *cls,
689 break; 689 break;
690 } 690 }
691 LOG (GNUNET_ERROR_TYPE_DEBUG, 691 LOG (GNUNET_ERROR_TYPE_DEBUG,
692 "Receiving `%s' message for `%4s'.\n", 692 "Receiving CONNECT message for `%4s'.\n",
693 "CONNECT", GNUNET_i2s (&cim->id)); 693 GNUNET_i2s (&cim->id));
694 n = neighbour_find (h, &cim->id); 694 n = neighbour_find (h, &cim->id);
695 if (NULL != n) 695 if (NULL != n)
696 { 696 {
@@ -699,8 +699,7 @@ demultiplexer (void *cls,
699 } 699 }
700 n = neighbour_add (h, &cim->id); 700 n = neighbour_add (h, &cim->id);
701 LOG (GNUNET_ERROR_TYPE_DEBUG, 701 LOG (GNUNET_ERROR_TYPE_DEBUG,
702 "Receiving `%s' message for `%4s' with quota %u\n", 702 "Receiving CONNECT message for `%4s' with quota %u\n",
703 "CONNECT",
704 GNUNET_i2s (&cim->id), 703 GNUNET_i2s (&cim->id),
705 ntohl (cim->quota_out.value__)); 704 ntohl (cim->quota_out.value__));
706 GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, 705 GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker,
@@ -717,8 +716,8 @@ demultiplexer (void *cls,
717 dim = (const struct DisconnectInfoMessage *) msg; 716 dim = (const struct DisconnectInfoMessage *) msg;
718 GNUNET_break (ntohl (dim->reserved) == 0); 717 GNUNET_break (ntohl (dim->reserved) == 0);
719 LOG (GNUNET_ERROR_TYPE_DEBUG, 718 LOG (GNUNET_ERROR_TYPE_DEBUG,
720 "Receiving `%s' message for `%4s'.\n", 719 "Receiving DISCONNECT message for `%4s'.\n",
721 "DISCONNECT", GNUNET_i2s (&dim->peer)); 720 GNUNET_i2s (&dim->peer));
722 n = neighbour_find (h, &dim->peer); 721 n = neighbour_find (h, &dim->peer);
723 if (NULL == n) 722 if (NULL == n)
724 { 723 {
@@ -766,9 +765,6 @@ demultiplexer (void *cls,
766 } 765 }
767 break; 766 break;
768 case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV: 767 case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV:
769 LOG (GNUNET_ERROR_TYPE_DEBUG,
770 "Receiving `%s' message.\n",
771 "RECV");
772 if (size < 768 if (size <
773 sizeof (struct InboundMessage) + sizeof (struct GNUNET_MessageHeader)) 769 sizeof (struct InboundMessage) + sizeof (struct GNUNET_MessageHeader))
774 { 770 {
@@ -795,8 +791,6 @@ demultiplexer (void *cls,
795 h->rec (h->cls, &im->peer, imm); 791 h->rec (h->cls, &im->peer, imm);
796 break; 792 break;
797 case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA: 793 case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA:
798 LOG (GNUNET_ERROR_TYPE_DEBUG,
799 "Receiving `%s' message.\n", "SET_QUOTA");
800 if (size != sizeof (struct QuotaSetMessage)) 794 if (size != sizeof (struct QuotaSetMessage))
801 { 795 {
802 GNUNET_break (0); 796 GNUNET_break (0);
@@ -807,16 +801,18 @@ demultiplexer (void *cls,
807 if (NULL == n) 801 if (NULL == n)
808 break; 802 break;
809 LOG (GNUNET_ERROR_TYPE_DEBUG, 803 LOG (GNUNET_ERROR_TYPE_DEBUG,
810 "Receiving `%s' message for `%4s' with quota %u\n", 804 "Receiving SET_QUOTA message for `%4s' with quota %u\n",
811 "SET_QUOTA",
812 GNUNET_i2s (&qm->peer), 805 GNUNET_i2s (&qm->peer),
813 ntohl (qm->quota.value__)); 806 ntohl (qm->quota.value__));
814 GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, qm->quota); 807 GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker,
808 qm->quota);
815 break; 809 break;
816 default: 810 default:
817 LOG (GNUNET_ERROR_TYPE_ERROR, 811 LOG (GNUNET_ERROR_TYPE_ERROR,
818 _("Received unexpected message of type %u in %s:%u\n"), 812 _("Received unexpected message of type %u in %s:%u\n"),
819 ntohs (msg->type), __FILE__, __LINE__); 813 ntohs (msg->type),
814 __FILE__,
815 __LINE__);
820 GNUNET_break (0); 816 GNUNET_break (0);
821 break; 817 break;
822 } 818 }
@@ -880,11 +876,14 @@ transport_notify_ready (void *cls, size_t size, void *buf)
880 /* first send control messages */ 876 /* first send control messages */
881 while ((NULL != (th = h->control_head)) && (th->notify_size <= size)) 877 while ((NULL != (th = h->control_head)) && (th->notify_size <= size))
882 { 878 {
883 GNUNET_CONTAINER_DLL_remove (h->control_head, h->control_tail, th); 879 GNUNET_CONTAINER_DLL_remove (h->control_head,
880 h->control_tail,
881 th);
884 nret = th->notify (th->notify_cls, size, &cbuf[ret]); 882 nret = th->notify (th->notify_cls, size, &cbuf[ret]);
885 LOG (GNUNET_ERROR_TYPE_DEBUG, 883 LOG (GNUNET_ERROR_TYPE_DEBUG,
886 "Added %u bytes of control message at %u\n", 884 "Added %u bytes of control message at %u\n",
887 nret, ret); 885 nret,
886 ret);
888 GNUNET_free (th); 887 GNUNET_free (th);
889 ret += nret; 888 ret += nret;
890 size -= nret; 889 size -= nret;
@@ -1093,13 +1092,11 @@ send_start (void *cls, size_t size, void *buf)
1093 { 1092 {
1094 /* Can only be shutdown, just give up */ 1093 /* Can only be shutdown, just give up */
1095 LOG (GNUNET_ERROR_TYPE_DEBUG, 1094 LOG (GNUNET_ERROR_TYPE_DEBUG,
1096 "Shutdown while trying to transmit `%s' request.\n", 1095 "Shutdown while trying to transmit START request.\n");
1097 "START");
1098 return 0; 1096 return 0;
1099 } 1097 }
1100 LOG (GNUNET_ERROR_TYPE_DEBUG, 1098 LOG (GNUNET_ERROR_TYPE_DEBUG,
1101 "Transmitting `%s' request.\n", 1099 "Transmitting START request.\n");
1102 "START");
1103 GNUNET_assert (size >= sizeof (struct StartMessage)); 1100 GNUNET_assert (size >= sizeof (struct StartMessage));
1104 s.header.size = htons (sizeof (struct StartMessage)); 1101 s.header.size = htons (sizeof (struct StartMessage));
1105 s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START); 1102 s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);