Set packets_left to default non zero values when creating connection.

This commit is contained in:
irungentoo 2014-07-14 16:37:43 -04:00
parent 4da8664a15
commit 2ea634ece2
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98

View File

@ -1485,6 +1485,7 @@ int accept_crypto_connection(Net_Crypto *c, New_Connection *n_c)
/* Status needs to be CRYPTO_CONN_NOT_CONFIRMED for this to work. */ /* Status needs to be CRYPTO_CONN_NOT_CONFIRMED for this to work. */
set_connection_dht_public_key(c, crypt_connection_id, n_c->dht_public_key, current_time_monotonic()); set_connection_dht_public_key(c, crypt_connection_id, n_c->dht_public_key, current_time_monotonic());
conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE; conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE;
conn->packets_left = CRYPTO_MIN_QUEUE_LENGTH;
crypto_connection_add_source(c, crypt_connection_id, n_c->source); crypto_connection_add_source(c, crypt_connection_id, n_c->source);
return crypt_connection_id; return crypt_connection_id;
} }
@ -1517,6 +1518,7 @@ int new_crypto_connection(Net_Crypto *c, const uint8_t *real_public_key)
crypto_box_keypair(conn->sessionpublic_key, conn->sessionsecret_key); crypto_box_keypair(conn->sessionpublic_key, conn->sessionsecret_key);
conn->status = CRYPTO_CONN_COOKIE_REQUESTING; conn->status = CRYPTO_CONN_COOKIE_REQUESTING;
conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE; conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE;
conn->packets_left = CRYPTO_MIN_QUEUE_LENGTH;
return crypt_connection_id; return crypt_connection_id;
} }