Fixed connection sometimes being too slow and some other possible problems.

This commit is contained in:
irungentoo 2013-10-19 22:29:48 -04:00
parent 368231b4f8
commit 147d820ad2
2 changed files with 9 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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. */