diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2024-02-26 08:52:42 +0100 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2024-02-26 08:52:42 +0100 |
commit | 6a5b821f68b595dd6bd3355c417a12abff137b41 (patch) | |
tree | 0187f1477a7a2ed88cfa4b9a5f4864023d11c441 | |
parent | 99d23f939cd1f717a6a52573f9e79a4fdf67a42d (diff) | |
download | gnunet-6a5b821f68b595dd6bd3355c417a12abff137b41.tar.gz gnunet-6a5b821f68b595dd6bd3355c417a12abff137b41.zip |
TRANSPORT: improve PEERSTORE API usage.
-rw-r--r-- | src/service/transport/gnunet-communicator-tcp.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/service/transport/gnunet-communicator-tcp.c b/src/service/transport/gnunet-communicator-tcp.c index 189febfda..0e061ab76 100644 --- a/src/service/transport/gnunet-communicator-tcp.c +++ b/src/service/transport/gnunet-communicator-tcp.c | |||
@@ -1273,6 +1273,7 @@ rekey_monotime_store_cb (void *cls, int success) | |||
1273 | "Failed to store rekey monotonic time in PEERSTORE!\n"); | 1273 | "Failed to store rekey monotonic time in PEERSTORE!\n"); |
1274 | } | 1274 | } |
1275 | queue->rekey_monotime_sc = NULL; | 1275 | queue->rekey_monotime_sc = NULL; |
1276 | GNUNET_PEERSTORE_iteration_next (queue->rekey_monotime_get, 1); | ||
1276 | } | 1277 | } |
1277 | 1278 | ||
1278 | 1279 | ||
@@ -1318,6 +1319,8 @@ rekey_monotime_cb (void *cls, | |||
1318 | "Queue from %s dropped, rekey monotime in the past\n", | 1319 | "Queue from %s dropped, rekey monotime in the past\n", |
1319 | GNUNET_i2s (&queue->target)); | 1320 | GNUNET_i2s (&queue->target)); |
1320 | GNUNET_break (0); | 1321 | GNUNET_break (0); |
1322 | GNUNET_PEERSTORE_iteration_stop (queue->rekey_monotime_get); | ||
1323 | queue->rekey_monotime_get = NULL; | ||
1321 | queue_finish (queue); | 1324 | queue_finish (queue); |
1322 | return; | 1325 | return; |
1323 | } | 1326 | } |
@@ -1332,7 +1335,6 @@ rekey_monotime_cb (void *cls, | |||
1332 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 1335 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
1333 | &rekey_monotime_store_cb, | 1336 | &rekey_monotime_store_cb, |
1334 | queue); | 1337 | queue); |
1335 | GNUNET_PEERSTORE_iteration_next (queue->rekey_monotime_get, 1); | ||
1336 | } | 1338 | } |
1337 | 1339 | ||
1338 | 1340 | ||
@@ -1432,6 +1434,7 @@ handshake_ack_monotime_store_cb (void *cls, int success) | |||
1432 | "Failed to store handshake ack monotonic time in PEERSTORE!\n"); | 1434 | "Failed to store handshake ack monotonic time in PEERSTORE!\n"); |
1433 | } | 1435 | } |
1434 | queue->handshake_ack_monotime_sc = NULL; | 1436 | queue->handshake_ack_monotime_sc = NULL; |
1437 | GNUNET_PEERSTORE_iteration_next (queue->handshake_ack_monotime_get, 1); | ||
1435 | } | 1438 | } |
1436 | 1439 | ||
1437 | 1440 | ||
@@ -1477,6 +1480,8 @@ handshake_ack_monotime_cb (void *cls, | |||
1477 | "Queue from %s dropped, handshake ack monotime in the past\n", | 1480 | "Queue from %s dropped, handshake ack monotime in the past\n", |
1478 | GNUNET_i2s (&queue->target)); | 1481 | GNUNET_i2s (&queue->target)); |
1479 | GNUNET_break (0); | 1482 | GNUNET_break (0); |
1483 | GNUNET_PEERSTORE_iteration_stop (queue->handshake_ack_monotime_get); | ||
1484 | queue->handshake_ack_monotime_get = NULL; | ||
1480 | queue_finish (queue); | 1485 | queue_finish (queue); |
1481 | return; | 1486 | return; |
1482 | } | 1487 | } |
@@ -1489,10 +1494,8 @@ handshake_ack_monotime_cb (void *cls, | |||
1489 | sizeof(*handshake_ack_monotonic_time), | 1494 | sizeof(*handshake_ack_monotonic_time), |
1490 | GNUNET_TIME_UNIT_FOREVER_ABS, | 1495 | GNUNET_TIME_UNIT_FOREVER_ABS, |
1491 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 1496 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
1492 | & | 1497 | &handshake_ack_monotime_store_cb, |
1493 | handshake_ack_monotime_store_cb, | ||
1494 | queue); | 1498 | queue); |
1495 | GNUNET_PEERSTORE_iteration_next (queue->handshake_ack_monotime_get, 1); | ||
1496 | } | 1499 | } |
1497 | 1500 | ||
1498 | 1501 | ||
@@ -1949,12 +1952,9 @@ try_handle_plaintext (struct Queue *queue) | |||
1949 | queue->handshake_ack_monotime_get = GNUNET_PEERSTORE_iteration_start ( | 1952 | queue->handshake_ack_monotime_get = GNUNET_PEERSTORE_iteration_start ( |
1950 | peerstore, | 1953 | peerstore, |
1951 | "transport_tcp_communicator", | 1954 | "transport_tcp_communicator", |
1952 | &queue-> | 1955 | &queue->target, |
1953 | target | ||
1954 | , | ||
1955 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK, | 1956 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK, |
1956 | & | 1957 | &handshake_ack_monotime_cb, |
1957 | handshake_ack_monotime_cb, | ||
1958 | queue); | 1958 | queue); |
1959 | 1959 | ||
1960 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1960 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2745,6 +2745,7 @@ handshake_monotime_store_cb (void *cls, int success) | |||
2745 | "Failed to store handshake monotonic time in PEERSTORE!\n"); | 2745 | "Failed to store handshake monotonic time in PEERSTORE!\n"); |
2746 | } | 2746 | } |
2747 | queue->handshake_monotime_sc = NULL; | 2747 | queue->handshake_monotime_sc = NULL; |
2748 | GNUNET_PEERSTORE_iteration_next (queue->handshake_ack_monotime_get, 1); | ||
2748 | } | 2749 | } |
2749 | 2750 | ||
2750 | 2751 | ||
@@ -2796,6 +2797,8 @@ handshake_monotime_cb (void *cls, | |||
2796 | "Queue from %s dropped, handshake monotime in the past\n", | 2797 | "Queue from %s dropped, handshake monotime in the past\n", |
2797 | GNUNET_i2s (&queue->target)); | 2798 | GNUNET_i2s (&queue->target)); |
2798 | GNUNET_break (0); | 2799 | GNUNET_break (0); |
2800 | GNUNET_PEERSTORE_iteration_stop (queue->handshake_ack_monotime_get); | ||
2801 | queue->handshake_ack_monotime_get = NULL; | ||
2799 | queue_finish (queue); | 2802 | queue_finish (queue); |
2800 | return; | 2803 | return; |
2801 | } | 2804 | } |
@@ -2811,7 +2814,6 @@ handshake_monotime_cb (void *cls, | |||
2811 | & | 2814 | & |
2812 | handshake_monotime_store_cb, | 2815 | handshake_monotime_store_cb, |
2813 | queue); | 2816 | queue); |
2814 | GNUNET_PEERSTORE_iteration_next (queue->handshake_ack_monotime_get, 1); | ||
2815 | } | 2817 | } |
2816 | 2818 | ||
2817 | 2819 | ||