mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed connection sometimes being too slow and some other possible problems.
This commit is contained in:
parent
368231b4f8
commit
147d820ad2
|
@ -704,10 +704,17 @@ static void receive_crypto(Net_Crypto *c)
|
|||
CONN_ESTABLISHED; /* Connection status needs to be 3 for write_cryptpacket() to work. */
|
||||
write_cryptpacket(c, i, ((uint8_t *)&zero), sizeof(zero));
|
||||
c->crypto_connections[i].status = CONN_NOT_CONFIRMED; /* Set it to its proper value right after. */
|
||||
} else {
|
||||
/* This should not happen, timeout the connection if it does. */
|
||||
c->crypto_connections[i].status = CONN_TIMED_OUT;
|
||||
}
|
||||
} else {
|
||||
/* This should not happen, timeout the connection if it does. */
|
||||
c->crypto_connections[i].status = CONN_TIMED_OUT;
|
||||
}
|
||||
} else if (id_packet(c->lossless_udp,
|
||||
c->crypto_connections[i].number) != -1) { // This should not happen, timeout the connection if it does.
|
||||
c->crypto_connections[i].number) != -1) {
|
||||
/* This should not happen, timeout the connection if it does. */
|
||||
c->crypto_connections[i].status = CONN_TIMED_OUT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#define CRYPTO_PACKET_FRIEND_REQ 32 /* Friend request crypto packet ID. */
|
||||
#define CRYPTO_PACKET_NAT_PING 254 /* NAT ping crypto packet ID. */
|
||||
#define CRYPTO_HANDSHAKE_TIMEOUT CONNEXION_TIMEOUT
|
||||
#define CRYPTO_HANDSHAKE_TIMEOUT (CONNEXION_TIMEOUT * 2)
|
||||
|
||||
typedef struct {
|
||||
uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The real public key of the peer. */
|
||||
|
|
Loading…
Reference in New Issue
Block a user