From 8b29ac8eae8feea8b2c12e56482dd8845e8c7d35 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Fri, 2 May 2014 15:25:18 -0400 Subject: Fixed one case of the handshake not being sent. --- toxcore/net_crypto.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'toxcore/net_crypto.c') diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 1dce61b2..d71ccdda 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -560,6 +560,19 @@ static int handle_packet_connection(Net_Crypto *c, int crypt_connection_id, uint encrypt_precompute(conn->peersessionpublic_key, conn->sessionsecret_key, conn->shared_key); + if (conn->status == CRYPTO_CONN_COOKIE_REQUESTING) { + uint8_t handshake_packet[HANDSHAKE_PACKET_LENGTH]; + + if (create_crypto_handshake(c, handshake_packet, cookie, conn->sent_nonce, conn->sessionpublic_key, + conn->public_key) != sizeof(handshake_packet)) + return -1; + + if (new_temp_packet(c, crypt_connection_id, handshake_packet, sizeof(handshake_packet)) != 0) + return -1; + + send_temp_packet(c, crypt_connection_id); + } + conn->status = CRYPTO_CONN_NOT_CONFIRMED; } else { return -1; -- cgit v1.2.3