diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-06-18 11:00:55 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-06-18 11:00:55 +0200 |
commit | 136adb0f87a645b392fef587a06fc34d4698f3ed (patch) | |
tree | 115cb974f54d05870e80eb173328e86e62a51dc5 /src/transport/gnunet-service-tng.c | |
parent | 4cdc3b856356a4eee10534834d84df4159568739 (diff) | |
download | gnunet-136adb0f87a645b392fef587a06fc34d4698f3ed.tar.gz gnunet-136adb0f87a645b392fef587a06fc34d4698f3ed.zip |
fix NPEs, off-by-one, etc
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r-- | src/transport/gnunet-service-tng.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index 803a8e518..bae187e7c 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -3872,11 +3872,12 @@ client_send_response (struct PendingMessage *pm) | |||
3872 | { | 3872 | { |
3873 | struct TransportClient *tc = pm->client; | 3873 | struct TransportClient *tc = pm->client; |
3874 | struct VirtualLink *vl = pm->vl; | 3874 | struct VirtualLink *vl = pm->vl; |
3875 | struct GNUNET_MQ_Envelope *env; | ||
3876 | struct SendOkMessage *som; | ||
3877 | 3875 | ||
3878 | if (NULL != tc) | 3876 | if (NULL != tc) |
3879 | { | 3877 | { |
3878 | struct GNUNET_MQ_Envelope *env; | ||
3879 | struct SendOkMessage *som; | ||
3880 | |||
3880 | env = GNUNET_MQ_msg (som, GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK); | 3881 | env = GNUNET_MQ_msg (som, GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK); |
3881 | som->peer = vl->target; | 3882 | som->peer = vl->target; |
3882 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3883 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -4593,11 +4594,11 @@ encapsulate_for_dv (struct DistanceVector *dv, | |||
4593 | char *path; | 4594 | char *path; |
4594 | 4595 | ||
4595 | path = GNUNET_strdup (GNUNET_i2s (&GST_my_identity)); | 4596 | path = GNUNET_strdup (GNUNET_i2s (&GST_my_identity)); |
4596 | for (unsigned int i = 0; i <= num_hops; i++) | 4597 | for (unsigned int j = 0; j <= num_hops; j++) |
4597 | { | 4598 | { |
4598 | char *tmp; | 4599 | char *tmp; |
4599 | 4600 | ||
4600 | GNUNET_asprintf (&tmp, "%s-%s", path, GNUNET_i2s (&dhops[i])); | 4601 | GNUNET_asprintf (&tmp, "%s-%s", path, GNUNET_i2s (&dhops[j])); |
4601 | GNUNET_free (path); | 4602 | GNUNET_free (path); |
4602 | path = tmp; | 4603 | path = tmp; |
4603 | } | 4604 | } |
@@ -5938,7 +5939,6 @@ handle_reliability_ack (void *cls, | |||
5938 | { | 5939 | { |
5939 | struct CommunicatorMessageContext *cmc = cls; | 5940 | struct CommunicatorMessageContext *cmc = cls; |
5940 | const struct TransportCummulativeAckPayloadP *ack; | 5941 | const struct TransportCummulativeAckPayloadP *ack; |
5941 | struct PendingAcknowledgement *pa; | ||
5942 | unsigned int n_acks; | 5942 | unsigned int n_acks; |
5943 | uint32_t ack_counter; | 5943 | uint32_t ack_counter; |
5944 | 5944 | ||
@@ -5947,7 +5947,7 @@ handle_reliability_ack (void *cls, | |||
5947 | ack = (const struct TransportCummulativeAckPayloadP *) &ra[1]; | 5947 | ack = (const struct TransportCummulativeAckPayloadP *) &ra[1]; |
5948 | for (unsigned int i = 0; i < n_acks; i++) | 5948 | for (unsigned int i = 0; i < n_acks; i++) |
5949 | { | 5949 | { |
5950 | pa = | 5950 | struct PendingAcknowledgement *pa = |
5951 | GNUNET_CONTAINER_multiuuidmap_get (pending_acks, &ack[i].ack_uuid.value); | 5951 | GNUNET_CONTAINER_multiuuidmap_get (pending_acks, &ack[i].ack_uuid.value); |
5952 | if (NULL == pa) | 5952 | if (NULL == pa) |
5953 | { | 5953 | { |
@@ -6886,7 +6886,7 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
6886 | 6886 | ||
6887 | if (0 == (bi_history & (1 << i))) | 6887 | if (0 == (bi_history & (1 << i))) |
6888 | break; /* i-th hop not bi-directional, stop learning! */ | 6888 | break; /* i-th hop not bi-directional, stop learning! */ |
6889 | if (i == nhops) | 6889 | if (i == nhops - 1) |
6890 | { | 6890 | { |
6891 | path[i + 2] = dvl->initiator; | 6891 | path[i + 2] = dvl->initiator; |
6892 | } | 6892 | } |
@@ -8629,7 +8629,6 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc, | |||
8629 | this queue */) ) | 8629 | this queue */) ) |
8630 | { | 8630 | { |
8631 | frag = GNUNET_YES; | 8631 | frag = GNUNET_YES; |
8632 | relb = GNUNET_NO; /* if we fragment, we never also reliability box */ | ||
8633 | if (GNUNET_TRANSPORT_CC_RELIABLE == queue->tc->details.communicator.cc) | 8632 | if (GNUNET_TRANSPORT_CC_RELIABLE == queue->tc->details.communicator.cc) |
8634 | { | 8633 | { |
8635 | /* FIXME-FRAG-REL-UUID: we could use an optimized, shorter fragmentation | 8634 | /* FIXME-FRAG-REL-UUID: we could use an optimized, shorter fragmentation |
@@ -8829,8 +8828,9 @@ transmit_on_queue (void *cls) | |||
8829 | "Fragmentation failed queue %s to %s for <%llu>, trying again\n", | 8828 | "Fragmentation failed queue %s to %s for <%llu>, trying again\n", |
8830 | queue->address, | 8829 | queue->address, |
8831 | GNUNET_i2s (&n->pid), | 8830 | GNUNET_i2s (&n->pid), |
8832 | pm->logging_uuid); | 8831 | sc.best->logging_uuid); |
8833 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); | 8832 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); |
8833 | return; | ||
8834 | } | 8834 | } |
8835 | } | 8835 | } |
8836 | else if (GNUNET_YES == sc.relb) | 8836 | else if (GNUNET_YES == sc.relb) |
@@ -8844,7 +8844,7 @@ transmit_on_queue (void *cls) | |||
8844 | "Reliability boxing failed queue %s to %s for <%llu>, trying again\n", | 8844 | "Reliability boxing failed queue %s to %s for <%llu>, trying again\n", |
8845 | queue->address, | 8845 | queue->address, |
8846 | GNUNET_i2s (&n->pid), | 8846 | GNUNET_i2s (&n->pid), |
8847 | pm->logging_uuid); | 8847 | sc.best->logging_uuid); |
8848 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); | 8848 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); |
8849 | return; | 8849 | return; |
8850 | } | 8850 | } |