aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-26 02:20:09 +0900
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-26 02:20:09 +0900
commit025568d66f1b4bf4007d8effdd73e3f36f26f78b (patch)
tree469ad81e2a94ac0e73a7ef43cce7fe68078ae716 /src/transport
parent7398be32b31ced600e182a3f63f3eddec0338dd9 (diff)
downloadgnunet-025568d66f1b4bf4007d8effdd73e3f36f26f78b.tar.gz
gnunet-025568d66f1b4bf4007d8effdd73e3f36f26f78b.zip
more fixed tcp comm
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-communicator-tcp.c17
-rw-r--r--src/transport/test_communicator_basic.c4
2 files changed, 11 insertions, 10 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 0b7f6ab46..c82fc88af 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -714,7 +714,6 @@ static void
714core_read_finished_cb (void *cls, int success) 714core_read_finished_cb (void *cls, int success)
715{ 715{
716 struct Queue *queue = cls; 716 struct Queue *queue = cls;
717
718 if (GNUNET_OK != success) 717 if (GNUNET_OK != success)
719 GNUNET_STATISTICS_update (stats, 718 GNUNET_STATISTICS_update (stats,
720 "# messages lost in communicator API towards CORE", 719 "# messages lost in communicator API towards CORE",
@@ -1064,13 +1063,12 @@ queue_read (void *cls)
1064 memmove (queue->cread_buf, &queue->cread_buf[max], queue->cread_off - max); 1063 memmove (queue->cread_buf, &queue->cread_buf[max], queue->cread_off - max);
1065 queue->cread_off -= max; 1064 queue->cread_off -= max;
1066 } 1065 }
1067
1068 if (BUF_SIZE == queue->cread_off) 1066 if (BUF_SIZE == queue->cread_off)
1069 return; /* buffer full, suspend reading */ 1067 return; /* buffer full, suspend reading */
1070 left = GNUNET_TIME_absolute_get_remaining (queue->timeout); 1068 left = GNUNET_TIME_absolute_get_remaining (queue->timeout);
1071 if (0 != left.rel_value_us) 1069 if (0 != left.rel_value_us)
1072 { 1070 {
1073 if (max_queue_length < queue->backpressure) 1071 if (max_queue_length > queue->backpressure)
1074 { 1072 {
1075 /* continue reading */ 1073 /* continue reading */
1076 left = GNUNET_TIME_absolute_get_remaining (queue->timeout); 1074 left = GNUNET_TIME_absolute_get_remaining (queue->timeout);
@@ -1346,7 +1344,7 @@ queue_write (void *cls)
1346 inject_rekey (queue); 1344 inject_rekey (queue);
1347 } 1345 }
1348 if ((0 == queue->pwrite_off) && (! queue->finishing) && 1346 if ((0 == queue->pwrite_off) && (! queue->finishing) &&
1349 (queue->mq_awaits_continue)) 1347 (GNUNET_YES == queue->mq_awaits_continue))
1350 { 1348 {
1351 queue->mq_awaits_continue = GNUNET_NO; 1349 queue->mq_awaits_continue = GNUNET_NO;
1352 GNUNET_MQ_impl_send_continue (queue->mq); 1350 GNUNET_MQ_impl_send_continue (queue->mq);
@@ -1718,6 +1716,7 @@ proto_read_kx (void *cls)
1718 queue->address = pq->address; /* steals reference */ 1716 queue->address = pq->address; /* steals reference */
1719 queue->address_len = pq->address_len; 1717 queue->address_len = pq->address_len;
1720 queue->target = tc.sender; 1718 queue->target = tc.sender;
1719 queue->sock = pq->sock;
1721 start_initial_kx_out (queue); 1720 start_initial_kx_out (queue);
1722 boot_queue (queue, GNUNET_TRANSPORT_CS_INBOUND); 1721 boot_queue (queue, GNUNET_TRANSPORT_CS_INBOUND);
1723 queue->read_task = 1722 queue->read_task =
@@ -1858,7 +1857,8 @@ queue_read_kx (void *cls)
1858 &queue->cread_buf[INITIAL_KX_SIZE], 1857 &queue->cread_buf[INITIAL_KX_SIZE],
1859 queue->cread_off - (INITIAL_KX_SIZE)); 1858 queue->cread_off - (INITIAL_KX_SIZE));
1860 queue->cread_off -= INITIAL_KX_SIZE; 1859 queue->cread_off -= INITIAL_KX_SIZE;
1861 queue->read_task = GNUNET_SCHEDULER_add_now (&queue_read, queue); 1860 if (0 < queue->cread_off)
1861 queue->read_task = GNUNET_SCHEDULER_add_now (&queue_read, queue);
1862} 1862}
1863 1863
1864 1864
@@ -1911,7 +1911,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
1911 GNUNET_free (in); 1911 GNUNET_free (in);
1912 return GNUNET_SYSERR; 1912 return GNUNET_SYSERR;
1913 } 1913 }
1914 if (GNUNET_OK != GNUNET_NETWORK_socket_connect (sock, in, in_len) && 1914 if ((GNUNET_OK != GNUNET_NETWORK_socket_connect (sock, in, in_len)) &&
1915 (errno != EINPROGRESS)) 1915 (errno != EINPROGRESS))
1916 { 1916 {
1917 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1917 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1929,6 +1929,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
1929 queue->address_len = in_len; 1929 queue->address_len = in_len;
1930 queue->sock = sock; 1930 queue->sock = sock;
1931 boot_queue (queue, GNUNET_TRANSPORT_CS_OUTBOUND); 1931 boot_queue (queue, GNUNET_TRANSPORT_CS_OUTBOUND);
1932 //queue->mq_awaits_continue = GNUNET_YES;
1932 queue->read_task = 1933 queue->read_task =
1933 GNUNET_SCHEDULER_add_read_net (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 1934 GNUNET_SCHEDULER_add_read_net (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
1934 queue->sock, 1935 queue->sock,
@@ -2255,8 +2256,8 @@ main (int argc, char *const *argv)
2255 options, 2256 options,
2256 &run, 2257 &run,
2257 NULL)) 2258 NULL))
2258 ? 0 2259 ? 0
2259 : 1; 2260 : 1;
2260 GNUNET_free ((void *) argv); 2261 GNUNET_free ((void *) argv);
2261 return ret; 2262 return ret;
2262} 2263}
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index 5d69b21b3..4dba9d50c 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -197,8 +197,8 @@ latency_timeout (void *cls)
197{ 197{
198 to_task = NULL; 198 to_task = NULL;
199 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 199 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
200 "Latency too high. Test failed. (Phase: %d. Received: %lu\n", 200 "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n",
201 phase, num_received); 201 phase, num_sent, num_received);
202 ret = 2; 202 ret = 2;
203 GNUNET_SCHEDULER_shutdown (); 203 GNUNET_SCHEDULER_shutdown ();
204} 204}