From 297ee1c85e3b8a1745193c854df2dec1126b7b99 Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Mon, 29 Nov 2021 13:24:29 +0100 Subject: - added number of unintentional connects to connect cmd, fixed bugs in tcp communicator and tng service, added method to get a cmd not restricted to future or past cmds --- src/transport/gnunet-communicator-tcp.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/transport/gnunet-communicator-tcp.c') diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 6f7e67d7b..2a5e33e2b 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c @@ -2556,11 +2556,17 @@ handshake_monotime_cb (void *cls, handshake_monotonic_time = &queue->handshake_monotonic_time; pid = &queue->target; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "tcp handshake with us %s\n", + GNUNET_i2s (&my_identity)); if (NULL == record) { queue->handshake_monotime_get = NULL; return; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "tcp handshake from peer %s\n", + GNUNET_i2s (pid)); if (sizeof(*mtbe) != record->value_size) { GNUNET_break (0); @@ -2610,6 +2616,7 @@ decrypt_and_check_tc (struct Queue *queue, char *ibuf) { struct TcpHandshakeSignature ths; + enum GNUNET_GenericReturnValue ret; GNUNET_assert ( 0 == @@ -2625,18 +2632,20 @@ decrypt_and_check_tc (struct Queue *queue, memcpy (&ths.ephemeral, ibuf, sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)); ths.monotonic_time = tc->monotonic_time; ths.challenge = tc->challenge; - queue->handshake_monotime_get = - GNUNET_PEERSTORE_iterate (peerstore, - "transport_tcp_communicator", - &queue->target, - GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE, - &handshake_monotime_cb, - queue); - return GNUNET_CRYPTO_eddsa_verify ( + ret = GNUNET_CRYPTO_eddsa_verify ( GNUNET_SIGNATURE_COMMUNICATOR_TCP_HANDSHAKE, &ths, &tc->sender_sig, &tc->sender.public_key); + if (GNUNET_YES == ret) + queue->handshake_monotime_get = + GNUNET_PEERSTORE_iterate (peerstore, + "transport_tcp_communicator", + &queue->target, + GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE, + &handshake_monotime_cb, + queue); + return ret; } -- cgit v1.2.3