diff options
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 22 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 109 | ||||
-rw-r--r-- | src/transport/transport_api.c | 31 |
3 files changed, 86 insertions, 76 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index f00f7c93f..3533b5f6d 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -709,15 +709,19 @@ handle_send_transmit_continuation (void *cls, | |||
709 | struct SendTransmitContinuationContext *stcc = cls; | 709 | struct SendTransmitContinuationContext *stcc = cls; |
710 | struct SendOkMessage send_ok_msg; | 710 | struct SendOkMessage send_ok_msg; |
711 | 711 | ||
712 | send_ok_msg.header.size = htons (sizeof (send_ok_msg)); | 712 | if (GST_neighbours_test_connected (&stcc->target)) |
713 | send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK); | 713 | { |
714 | send_ok_msg.bytes_msg = htonl (bytes_payload); | 714 | /* Only send confirmation if we are still connected */ |
715 | send_ok_msg.bytes_physical = htonl (bytes_on_wire); | 715 | send_ok_msg.header.size = htons (sizeof (send_ok_msg)); |
716 | send_ok_msg.success = htonl (success); | 716 | send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK); |
717 | send_ok_msg.peer = stcc->target; | 717 | send_ok_msg.bytes_msg = htonl (bytes_payload); |
718 | GST_clients_unicast (stcc->client, | 718 | send_ok_msg.bytes_physical = htonl (bytes_on_wire); |
719 | &send_ok_msg.header, | 719 | send_ok_msg.success = htonl (success); |
720 | GNUNET_NO); | 720 | send_ok_msg.peer = stcc->target; |
721 | GST_clients_unicast (stcc->client, | ||
722 | &send_ok_msg.header, | ||
723 | GNUNET_NO); | ||
724 | } | ||
721 | GNUNET_SERVER_client_drop (stcc->client); | 725 | GNUNET_SERVER_client_drop (stcc->client); |
722 | GNUNET_free (stcc); | 726 | GNUNET_free (stcc); |
723 | } | 727 | } |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 7b8a9a327..ad2947418 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -559,28 +559,32 @@ print_ack_state (enum GST_ACK_State s) | |||
559 | /** | 559 | /** |
560 | * Notify our clients that another peer connected to us. | 560 | * Notify our clients that another peer connected to us. |
561 | * | 561 | * |
562 | * @param peer the peer that connected | 562 | * @param n the peer that connected |
563 | * @param bandwidth_in inbound bandwidth in NBO | ||
564 | * @param bandwidth_out outbound bandwidth in NBO | ||
565 | */ | 563 | */ |
566 | static void | 564 | static void |
567 | neighbours_connect_notification (const struct GNUNET_PeerIdentity *peer, | 565 | neighbours_connect_notification (struct NeighbourMapEntry *n) |
568 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | ||
569 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) | ||
570 | { | 566 | { |
571 | size_t len = sizeof(struct ConnectInfoMessage); | 567 | size_t len = sizeof(struct ConnectInfoMessage); |
572 | char buf[len] GNUNET_ALIGN; | 568 | char buf[len] GNUNET_ALIGN; |
573 | struct ConnectInfoMessage *connect_msg = (struct ConnectInfoMessage *) buf; | 569 | struct ConnectInfoMessage *connect_msg = (struct ConnectInfoMessage *) buf; |
570 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min; | ||
574 | 571 | ||
572 | #if IGNORE_INBOUND_QUOTA | ||
573 | bandwidth_min = n->primary_address.bandwidth_out; | ||
574 | #else | ||
575 | bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out, | ||
576 | n->neighbour_receive_quota); | ||
577 | #endif | ||
575 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 578 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
576 | "We are now connected to peer `%s'\n", | 579 | "We are now connected to peer `%s'\n", |
577 | GNUNET_i2s (peer)); | 580 | GNUNET_i2s (&n->id)); |
578 | connect_msg->header.size = htons (sizeof(buf)); | 581 | connect_msg->header.size = htons (sizeof(buf)); |
579 | connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 582 | connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
580 | connect_msg->id = *peer; | 583 | connect_msg->id = n->id; |
581 | connect_msg->quota_in = bandwidth_in; | 584 | connect_msg->quota_in = n->primary_address.bandwidth_in; |
582 | connect_msg->quota_out = bandwidth_out; | 585 | connect_msg->quota_out = bandwidth_min; |
583 | GST_clients_broadcast (&connect_msg->header, GNUNET_NO); | 586 | GST_clients_broadcast (&connect_msg->header, |
587 | GNUNET_NO); | ||
584 | } | 588 | } |
585 | 589 | ||
586 | 590 | ||
@@ -588,21 +592,21 @@ neighbours_connect_notification (const struct GNUNET_PeerIdentity *peer, | |||
588 | * Notify our clients (and manipulation) that a peer disconnected from | 592 | * Notify our clients (and manipulation) that a peer disconnected from |
589 | * us. | 593 | * us. |
590 | * | 594 | * |
591 | * @param peer the peer that disconnected | 595 | * @param n the peer that disconnected |
592 | */ | 596 | */ |
593 | static void | 597 | static void |
594 | neighbours_disconnect_notification (const struct GNUNET_PeerIdentity *peer) | 598 | neighbours_disconnect_notification (struct NeighbourMapEntry *n) |
595 | { | 599 | { |
596 | struct DisconnectInfoMessage disconnect_msg; | 600 | struct DisconnectInfoMessage disconnect_msg; |
597 | 601 | ||
598 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 602 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
599 | "Peer `%s' disconnected\n", | 603 | "Peer `%s' disconnected\n", |
600 | GNUNET_i2s (peer)); | 604 | GNUNET_i2s (&n->id)); |
601 | GST_manipulation_peer_disconnect (peer); | 605 | GST_manipulation_peer_disconnect (&n->id); |
602 | disconnect_msg.header.size = htons (sizeof(struct DisconnectInfoMessage)); | 606 | disconnect_msg.header.size = htons (sizeof(struct DisconnectInfoMessage)); |
603 | disconnect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT); | 607 | disconnect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT); |
604 | disconnect_msg.reserved = htonl (0); | 608 | disconnect_msg.reserved = htonl (0); |
605 | disconnect_msg.peer = *peer; | 609 | disconnect_msg.peer = n->id; |
606 | GST_clients_broadcast (&disconnect_msg.header, | 610 | GST_clients_broadcast (&disconnect_msg.header, |
607 | GNUNET_NO); | 611 | GNUNET_NO); |
608 | } | 612 | } |
@@ -676,23 +680,31 @@ test_connected (struct NeighbourMapEntry *n) | |||
676 | * Note that the outbound quota is enforced client-side (i.e. | 680 | * Note that the outbound quota is enforced client-side (i.e. |
677 | * in libgnunettransport). | 681 | * in libgnunettransport). |
678 | * | 682 | * |
679 | * @param target affected peer | 683 | * @param n affected peer |
680 | * @param quota new quota | ||
681 | */ | 684 | */ |
682 | static void | 685 | static void |
683 | send_outbound_quota_to_clients (const struct GNUNET_PeerIdentity *target, | 686 | send_outbound_quota_to_clients (struct NeighbourMapEntry *n) |
684 | struct GNUNET_BANDWIDTH_Value32NBO quota) | ||
685 | { | 687 | { |
686 | struct QuotaSetMessage q_msg; | 688 | struct QuotaSetMessage q_msg; |
689 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min; | ||
690 | |||
691 | if (! GNUNET_TRANSPORT_is_connected (n->state)) | ||
692 | return; | ||
693 | #if IGNORE_INBOUND_QUOTA | ||
694 | bandwidth_min = n->primary_address.bandwidth_out; | ||
695 | #else | ||
696 | bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out, | ||
697 | n->neighbour_receive_quota); | ||
698 | #endif | ||
687 | 699 | ||
688 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 700 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
689 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", | 701 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", |
690 | ntohl (quota.value__), | 702 | ntohl (bandwidth_min.value__), |
691 | GNUNET_i2s (target)); | 703 | GNUNET_i2s (&n->id)); |
692 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); | 704 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); |
693 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | 705 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); |
694 | q_msg.quota = quota; | 706 | q_msg.quota = bandwidth_min; |
695 | q_msg.peer = (*target); | 707 | q_msg.peer = n->id; |
696 | GST_clients_broadcast (&q_msg.header, GNUNET_NO); | 708 | GST_clients_broadcast (&q_msg.header, GNUNET_NO); |
697 | } | 709 | } |
698 | 710 | ||
@@ -753,9 +765,7 @@ set_state_and_timeout (struct NeighbourMapEntry *n, | |||
753 | if (GNUNET_TRANSPORT_is_connected (s) && | 765 | if (GNUNET_TRANSPORT_is_connected (s) && |
754 | ! GNUNET_TRANSPORT_is_connected (n->state) ) | 766 | ! GNUNET_TRANSPORT_is_connected (n->state) ) |
755 | { | 767 | { |
756 | neighbours_connect_notification (&n->id, | 768 | neighbours_connect_notification (n); |
757 | n->primary_address.bandwidth_in, | ||
758 | n->primary_address.bandwidth_out); | ||
759 | GNUNET_STATISTICS_set (GST_stats, | 769 | GNUNET_STATISTICS_set (GST_stats, |
760 | gettext_noop ("# peers connected"), | 770 | gettext_noop ("# peers connected"), |
761 | ++neighbours_connected, | 771 | ++neighbours_connected, |
@@ -768,7 +778,7 @@ set_state_and_timeout (struct NeighbourMapEntry *n, | |||
768 | gettext_noop ("# peers connected"), | 778 | gettext_noop ("# peers connected"), |
769 | --neighbours_connected, | 779 | --neighbours_connected, |
770 | GNUNET_NO); | 780 | GNUNET_NO); |
771 | neighbours_disconnect_notification (&n->id); | 781 | neighbours_disconnect_notification (n); |
772 | } | 782 | } |
773 | n->state = s; | 783 | n->state = s; |
774 | if ( (timeout.abs_value_us < n->timeout.abs_value_us) && | 784 | if ( (timeout.abs_value_us < n->timeout.abs_value_us) && |
@@ -1229,8 +1239,6 @@ set_primary_address (struct NeighbourMapEntry *n, | |||
1229 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 1239 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
1230 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) | 1240 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
1231 | { | 1241 | { |
1232 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min; | ||
1233 | |||
1234 | if (session == n->primary_address.session) | 1242 | if (session == n->primary_address.session) |
1235 | { | 1243 | { |
1236 | GST_validation_set_address_use (n->primary_address.address, | 1244 | GST_validation_set_address_use (n->primary_address.address, |
@@ -1244,14 +1252,7 @@ set_primary_address (struct NeighbourMapEntry *n, | |||
1244 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) | 1252 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) |
1245 | { | 1253 | { |
1246 | n->primary_address.bandwidth_out = bandwidth_out; | 1254 | n->primary_address.bandwidth_out = bandwidth_out; |
1247 | #if IGNORE_INBOUND_QUOTA | 1255 | send_outbound_quota_to_clients (n); |
1248 | bandwidth_min = bandwidth_out; | ||
1249 | #else | ||
1250 | bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out, | ||
1251 | n->neighbour_receive_quota); | ||
1252 | #endif | ||
1253 | send_outbound_quota_to_clients (&address->peer, | ||
1254 | bandwidth_min); | ||
1255 | } | 1256 | } |
1256 | return; | 1257 | return; |
1257 | } | 1258 | } |
@@ -1288,14 +1289,7 @@ set_primary_address (struct NeighbourMapEntry *n, | |||
1288 | GNUNET_YES); | 1289 | GNUNET_YES); |
1289 | set_incoming_quota (n, | 1290 | set_incoming_quota (n, |
1290 | bandwidth_in); | 1291 | bandwidth_in); |
1291 | #if IGNORE_INBOUND_QUOTA | 1292 | send_outbound_quota_to_clients (n); |
1292 | bandwidth_min = bandwidth_out; | ||
1293 | #else | ||
1294 | bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out, | ||
1295 | n->neighbour_receive_quota); | ||
1296 | #endif | ||
1297 | send_outbound_quota_to_clients (&address->peer, | ||
1298 | bandwidth_min); | ||
1299 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1293 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1300 | "Neighbour `%s' switched to address `%s'\n", | 1294 | "Neighbour `%s' switched to address `%s'\n", |
1301 | GNUNET_i2s (&n->id), | 1295 | GNUNET_i2s (&n->id), |
@@ -2215,7 +2209,8 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer) | |||
2215 | GNUNET_TIME_UNIT_FOREVER_ABS); | 2209 | GNUNET_TIME_UNIT_FOREVER_ABS); |
2216 | GNUNET_assert (GNUNET_OK == | 2210 | GNUNET_assert (GNUNET_OK == |
2217 | GNUNET_CONTAINER_multipeermap_put (neighbours, | 2211 | GNUNET_CONTAINER_multipeermap_put (neighbours, |
2218 | &n->id, n, | 2212 | &n->id, |
2213 | n, | ||
2219 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 2214 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
2220 | n->suggest_handle = GNUNET_ATS_connectivity_suggest (GST_ats_connect, | 2215 | n->suggest_handle = GNUNET_ATS_connectivity_suggest (GST_ats_connect, |
2221 | peer); | 2216 | peer); |
@@ -2544,7 +2539,6 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address, | |||
2544 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) | 2539 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
2545 | { | 2540 | { |
2546 | struct NeighbourMapEntry *n; | 2541 | struct NeighbourMapEntry *n; |
2547 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min; | ||
2548 | 2542 | ||
2549 | n = lookup_neighbour (&address->peer); | 2543 | n = lookup_neighbour (&address->peer); |
2550 | if ( (NULL == n) || | 2544 | if ( (NULL == n) || |
@@ -2572,14 +2566,7 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address, | |||
2572 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) | 2566 | if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) |
2573 | { | 2567 | { |
2574 | n->primary_address.bandwidth_out = bandwidth_out; | 2568 | n->primary_address.bandwidth_out = bandwidth_out; |
2575 | #if IGNORE_INBOUND_QUOTA | 2569 | send_outbound_quota_to_clients (n); |
2576 | bandwidth_min = bandwidth_out; | ||
2577 | #else | ||
2578 | bandwidth_min = GNUNET_BANDWIDTH_value_min (bandwidth_out, | ||
2579 | n->neighbour_receive_quota); | ||
2580 | #endif | ||
2581 | send_outbound_quota_to_clients (&address->peer, | ||
2582 | bandwidth_min); | ||
2583 | } | 2570 | } |
2584 | return GNUNET_OK; | 2571 | return GNUNET_OK; |
2585 | } | 2572 | } |
@@ -3687,7 +3674,6 @@ GST_neighbours_handle_quota_message (const struct GNUNET_PeerIdentity *peer, | |||
3687 | { | 3674 | { |
3688 | struct NeighbourMapEntry *n; | 3675 | struct NeighbourMapEntry *n; |
3689 | const struct SessionQuotaMessage *sqm; | 3676 | const struct SessionQuotaMessage *sqm; |
3690 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min; | ||
3691 | 3677 | ||
3692 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3678 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3693 | "Received QUOTA message from peer `%s'\n", | 3679 | "Received QUOTA message from peer `%s'\n", |
@@ -3714,14 +3700,7 @@ GST_neighbours_handle_quota_message (const struct GNUNET_PeerIdentity *peer, | |||
3714 | n->neighbour_receive_quota | 3700 | n->neighbour_receive_quota |
3715 | = GNUNET_BANDWIDTH_value_max (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, | 3701 | = GNUNET_BANDWIDTH_value_max (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, |
3716 | GNUNET_BANDWIDTH_value_init (ntohl (sqm->quota))); | 3702 | GNUNET_BANDWIDTH_value_init (ntohl (sqm->quota))); |
3717 | #if IGNORE_INBOUND_QUOTA | 3703 | send_outbound_quota_to_clients (n); |
3718 | bandwidth_min = n->primary_address.bandwidth_out; | ||
3719 | #else | ||
3720 | bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out, | ||
3721 | n->neighbour_receive_quota); | ||
3722 | #endif | ||
3723 | send_outbound_quota_to_clients (peer, | ||
3724 | bandwidth_min); | ||
3725 | } | 3704 | } |
3726 | 3705 | ||
3727 | 3706 | ||
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 47bdef88e..dca9b4b78 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -743,6 +743,8 @@ demultiplexer (void *cls, | |||
743 | if (size < sizeof (struct ConnectInfoMessage)) | 743 | if (size < sizeof (struct ConnectInfoMessage)) |
744 | { | 744 | { |
745 | GNUNET_break (0); | 745 | GNUNET_break (0); |
746 | h->reconnecting = GNUNET_YES; | ||
747 | disconnect_and_schedule_reconnect (h); | ||
746 | break; | 748 | break; |
747 | } | 749 | } |
748 | cim = (const struct ConnectInfoMessage *) msg; | 750 | cim = (const struct ConnectInfoMessage *) msg; |
@@ -750,6 +752,8 @@ demultiplexer (void *cls, | |||
750 | sizeof (struct ConnectInfoMessage)) | 752 | sizeof (struct ConnectInfoMessage)) |
751 | { | 753 | { |
752 | GNUNET_break (0); | 754 | GNUNET_break (0); |
755 | h->reconnecting = GNUNET_YES; | ||
756 | disconnect_and_schedule_reconnect (h); | ||
753 | break; | 757 | break; |
754 | } | 758 | } |
755 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 759 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -759,6 +763,8 @@ demultiplexer (void *cls, | |||
759 | if (NULL != n) | 763 | if (NULL != n) |
760 | { | 764 | { |
761 | GNUNET_break (0); | 765 | GNUNET_break (0); |
766 | h->reconnecting = GNUNET_YES; | ||
767 | disconnect_and_schedule_reconnect (h); | ||
762 | break; | 768 | break; |
763 | } | 769 | } |
764 | n = neighbour_add (h, | 770 | n = neighbour_add (h, |
@@ -777,6 +783,8 @@ demultiplexer (void *cls, | |||
777 | if (size != sizeof (struct DisconnectInfoMessage)) | 783 | if (size != sizeof (struct DisconnectInfoMessage)) |
778 | { | 784 | { |
779 | GNUNET_break (0); | 785 | GNUNET_break (0); |
786 | h->reconnecting = GNUNET_YES; | ||
787 | disconnect_and_schedule_reconnect (h); | ||
780 | break; | 788 | break; |
781 | } | 789 | } |
782 | dim = (const struct DisconnectInfoMessage *) msg; | 790 | dim = (const struct DisconnectInfoMessage *) msg; |
@@ -788,6 +796,8 @@ demultiplexer (void *cls, | |||
788 | if (NULL == n) | 796 | if (NULL == n) |
789 | { | 797 | { |
790 | GNUNET_break (0); | 798 | GNUNET_break (0); |
799 | h->reconnecting = GNUNET_YES; | ||
800 | disconnect_and_schedule_reconnect (h); | ||
791 | break; | 801 | break; |
792 | } | 802 | } |
793 | neighbour_delete (h, | 803 | neighbour_delete (h, |
@@ -798,6 +808,8 @@ demultiplexer (void *cls, | |||
798 | if (size != sizeof (struct SendOkMessage)) | 808 | if (size != sizeof (struct SendOkMessage)) |
799 | { | 809 | { |
800 | GNUNET_break (0); | 810 | GNUNET_break (0); |
811 | h->reconnecting = GNUNET_YES; | ||
812 | disconnect_and_schedule_reconnect (h); | ||
801 | break; | 813 | break; |
802 | } | 814 | } |
803 | okm = (const struct SendOkMessage *) msg; | 815 | okm = (const struct SendOkMessage *) msg; |
@@ -811,9 +823,11 @@ demultiplexer (void *cls, | |||
811 | &okm->peer); | 823 | &okm->peer); |
812 | if (NULL == n) | 824 | if (NULL == n) |
813 | { | 825 | { |
814 | /* we should never get a 'SEND_OK' for a peer that we are not | 826 | /* We should never get a 'SEND_OK' for a peer that we are not |
815 | connected to */ | 827 | connected to */ |
816 | GNUNET_break (0); | 828 | GNUNET_break (0); |
829 | h->reconnecting = GNUNET_YES; | ||
830 | disconnect_and_schedule_reconnect (h); | ||
817 | break; | 831 | break; |
818 | } | 832 | } |
819 | if (bytes_physical >= bytes_msg) | 833 | if (bytes_physical >= bytes_msg) |
@@ -847,6 +861,8 @@ demultiplexer (void *cls, | |||
847 | sizeof (struct InboundMessage) + sizeof (struct GNUNET_MessageHeader)) | 861 | sizeof (struct InboundMessage) + sizeof (struct GNUNET_MessageHeader)) |
848 | { | 862 | { |
849 | GNUNET_break (0); | 863 | GNUNET_break (0); |
864 | h->reconnecting = GNUNET_YES; | ||
865 | disconnect_and_schedule_reconnect (h); | ||
850 | break; | 866 | break; |
851 | } | 867 | } |
852 | im = (const struct InboundMessage *) msg; | 868 | im = (const struct InboundMessage *) msg; |
@@ -854,6 +870,8 @@ demultiplexer (void *cls, | |||
854 | if (ntohs (imm->size) + sizeof (struct InboundMessage) != size) | 870 | if (ntohs (imm->size) + sizeof (struct InboundMessage) != size) |
855 | { | 871 | { |
856 | GNUNET_break (0); | 872 | GNUNET_break (0); |
873 | h->reconnecting = GNUNET_YES; | ||
874 | disconnect_and_schedule_reconnect (h); | ||
857 | break; | 875 | break; |
858 | } | 876 | } |
859 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 877 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -863,6 +881,8 @@ demultiplexer (void *cls, | |||
863 | if (NULL == n) | 881 | if (NULL == n) |
864 | { | 882 | { |
865 | GNUNET_break (0); | 883 | GNUNET_break (0); |
884 | h->reconnecting = GNUNET_YES; | ||
885 | disconnect_and_schedule_reconnect (h); | ||
866 | break; | 886 | break; |
867 | } | 887 | } |
868 | if (NULL != h->rec) | 888 | if (NULL != h->rec) |
@@ -874,12 +894,19 @@ demultiplexer (void *cls, | |||
874 | if (size != sizeof (struct QuotaSetMessage)) | 894 | if (size != sizeof (struct QuotaSetMessage)) |
875 | { | 895 | { |
876 | GNUNET_break (0); | 896 | GNUNET_break (0); |
897 | h->reconnecting = GNUNET_YES; | ||
898 | disconnect_and_schedule_reconnect (h); | ||
877 | break; | 899 | break; |
878 | } | 900 | } |
879 | qm = (const struct QuotaSetMessage *) msg; | 901 | qm = (const struct QuotaSetMessage *) msg; |
880 | n = neighbour_find (h, &qm->peer); | 902 | n = neighbour_find (h, &qm->peer); |
881 | if (NULL == n) | 903 | if (NULL == n) |
904 | { | ||
905 | GNUNET_break (0); | ||
906 | h->reconnecting = GNUNET_YES; | ||
907 | disconnect_and_schedule_reconnect (h); | ||
882 | break; | 908 | break; |
909 | } | ||
883 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 910 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
884 | "Receiving SET_QUOTA message for `%s' with quota %u\n", | 911 | "Receiving SET_QUOTA message for `%s' with quota %u\n", |
885 | GNUNET_i2s (&qm->peer), | 912 | GNUNET_i2s (&qm->peer), |
@@ -1305,7 +1332,7 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) | |||
1305 | { | 1332 | { |
1306 | struct GNUNET_TRANSPORT_TransmitHandle *th; | 1333 | struct GNUNET_TRANSPORT_TransmitHandle *th; |
1307 | 1334 | ||
1308 | GNUNET_assert (h->reconnect_task == NULL); | 1335 | GNUNET_assert (NULL == h->reconnect_task); |
1309 | if (NULL != h->cth) | 1336 | if (NULL != h->cth) |
1310 | { | 1337 | { |
1311 | GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); | 1338 | GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); |