diff options
Diffstat (limited to 'toxcore/Lossless_UDP.c')
-rw-r--r-- | toxcore/Lossless_UDP.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c index 6d82b768..e291340d 100644 --- a/toxcore/Lossless_UDP.c +++ b/toxcore/Lossless_UDP.c | |||
@@ -198,8 +198,8 @@ int new_connection(Lossless_UDP *ludp, IP_Port ip_port) | |||
198 | memset(connection, 0, sizeof(Connection)); | 198 | memset(connection, 0, sizeof(Connection)); |
199 | 199 | ||
200 | uint32_t handshake_id1 = handshake_id(ludp, ip_port); | 200 | uint32_t handshake_id1 = handshake_id(ludp, ip_port); |
201 | /* add randomness to timeout to prevent connections getting stuck in a loop. */ | 201 | /* Add randomness to timeout to prevent connections getting stuck in a loop. */ |
202 | uint8_t timeout = CONNEXION_TIMEOUT + rand() % CONNEXION_TIMEOUT; | 202 | uint8_t timeout = CONNECTION_TIMEOUT + rand() % CONNECTION_TIMEOUT; |
203 | 203 | ||
204 | *connection = (Connection) { | 204 | *connection = (Connection) { |
205 | .ip_port = ip_port, | 205 | .ip_port = ip_port, |
@@ -260,7 +260,7 @@ static int new_inconnection(Lossless_UDP *ludp, IP_Port ip_port) | |||
260 | Connection *connection = &tox_array_get(&ludp->connections, connection_id, Connection); | 260 | Connection *connection = &tox_array_get(&ludp->connections, connection_id, Connection); |
261 | memset(connection, 0, sizeof(Connection)); | 261 | memset(connection, 0, sizeof(Connection)); |
262 | /* Add randomness to timeout to prevent connections getting stuck in a loop. */ | 262 | /* Add randomness to timeout to prevent connections getting stuck in a loop. */ |
263 | uint8_t timeout = CONNEXION_TIMEOUT + rand() % CONNEXION_TIMEOUT; | 263 | uint8_t timeout = CONNECTION_TIMEOUT + rand() % CONNECTION_TIMEOUT; |
264 | 264 | ||
265 | *connection = (Connection) { | 265 | *connection = (Connection) { |
266 | .ip_port = ip_port, | 266 | .ip_port = ip_port, |
@@ -403,7 +403,7 @@ int connection_confirmed(Lossless_UDP *ludp, int connection_id) | |||
403 | } | 403 | } |
404 | 404 | ||
405 | /* Confirm an incoming connection. | 405 | /* Confirm an incoming connection. |
406 | * Also disables the auto kill timeout on incomming connections. | 406 | * Also disable the auto kill timeout on incomming connections. |
407 | * | 407 | * |
408 | * return 0 on success | 408 | * return 0 on success |
409 | * return -1 on failure. | 409 | * return -1 on failure. |
@@ -777,7 +777,7 @@ static int handle_handshake(void *object, IP_Port source, uint8_t *packet, uint3 | |||
777 | /* if handshake_id2 is what we sent previously as handshake_id1 */ | 777 | /* if handshake_id2 is what we sent previously as handshake_id1 */ |
778 | if (handshake_id2 == connection->handshake_id1) { | 778 | if (handshake_id2 == connection->handshake_id1) { |
779 | connection->status = LUDP_NOT_CONFIRMED; | 779 | connection->status = LUDP_NOT_CONFIRMED; |
780 | /* NOTE: is this necessary? | 780 | /* NOTE: Is this necessary? |
781 | connection->handshake_id2 = handshake_id1; */ | 781 | connection->handshake_id2 = handshake_id1; */ |
782 | connection->orecv_packetnum = handshake_id2; | 782 | connection->orecv_packetnum = handshake_id2; |
783 | connection->osent_packetnum = handshake_id1; | 783 | connection->osent_packetnum = handshake_id1; |
@@ -847,7 +847,7 @@ static int handle_SYNC2(Lossless_UDP *ludp, int connection_id, uint8_t counter, | |||
847 | /* | 847 | /* |
848 | * Automatically adjusts send rates of data packets for optimal transmission. | 848 | * Automatically adjusts send rates of data packets for optimal transmission. |
849 | * | 849 | * |
850 | * TODO: Impove this. | 850 | * TODO: Improve this. |
851 | */ | 851 | */ |
852 | static void adjust_datasendspeed(Connection *connection, uint32_t req_packets) | 852 | static void adjust_datasendspeed(Connection *connection, uint32_t req_packets) |
853 | { | 853 | { |
@@ -1144,7 +1144,7 @@ static void adjust_rates(Lossless_UDP *ludp) | |||
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | /* Call this function a couple times per second It's the main loop. */ | 1147 | /* Call this function a couple times per second. It is the main loop. */ |
1148 | void do_lossless_udp(Lossless_UDP *ludp) | 1148 | void do_lossless_udp(Lossless_UDP *ludp) |
1149 | { | 1149 | { |
1150 | do_new(ludp); | 1150 | do_new(ludp); |