diff options
-rw-r--r-- | toxcore/Lossless_UDP.c | 8 | ||||
-rw-r--r-- | toxcore/Lossless_UDP.h | 2 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c index ca8ba8e0..01f9ccc2 100644 --- a/toxcore/Lossless_UDP.c +++ b/toxcore/Lossless_UDP.c | |||
@@ -480,19 +480,19 @@ uint32_t recvqueue(Lossless_UDP *ludp, int connection_id) | |||
480 | } | 480 | } |
481 | 481 | ||
482 | /* return the id of the next packet in the queue. | 482 | /* return the id of the next packet in the queue. |
483 | * return -1 if no packet in queue. | 483 | * return ~0 if no packet in queue. |
484 | */ | 484 | */ |
485 | char id_packet(Lossless_UDP *ludp, int connection_id) | 485 | uint8_t id_packet(Lossless_UDP *ludp, int connection_id) |
486 | { | 486 | { |
487 | if (recvqueue(ludp, connection_id) == 0) | 487 | if (recvqueue(ludp, connection_id) == 0) |
488 | return -1; | 488 | return ~0; |
489 | 489 | ||
490 | Connection *connection = &tox_array_get(&ludp->connections, connection_id, Connection); | 490 | Connection *connection = &tox_array_get(&ludp->connections, connection_id, Connection); |
491 | 491 | ||
492 | if (connection->status != LUDP_NO_CONNECTION) | 492 | if (connection->status != LUDP_NO_CONNECTION) |
493 | return connection->recvbuffer[connection->successful_read % connection->recvbuffer_length].data[0]; | 493 | return connection->recvbuffer[connection->successful_read % connection->recvbuffer_length].data[0]; |
494 | 494 | ||
495 | return -1; | 495 | return ~0; |
496 | } | 496 | } |
497 | 497 | ||
498 | /* return 0 if there is no received data in the buffer. | 498 | /* return 0 if there is no received data in the buffer. |
diff --git a/toxcore/Lossless_UDP.h b/toxcore/Lossless_UDP.h index d4d6ec4e..b23d602a 100644 --- a/toxcore/Lossless_UDP.h +++ b/toxcore/Lossless_UDP.h | |||
@@ -198,7 +198,7 @@ IP_Port connection_ip(Lossless_UDP *ludp, int connection_id); | |||
198 | /* returns the id of the next packet in the queue. | 198 | /* returns the id of the next packet in the queue. |
199 | * return -1 if no packet in queue. | 199 | * return -1 if no packet in queue. |
200 | */ | 200 | */ |
201 | char id_packet(Lossless_UDP *ludp, int connection_id); | 201 | uint8_t id_packet(Lossless_UDP *ludp, int connection_id); |
202 | 202 | ||
203 | /* return 0 if there is no received data in the buffer. | 203 | /* return 0 if there is no received data in the buffer. |
204 | * return length of received packet if successful. | 204 | * return length of received packet if successful. |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 6b64c1b6..9b0f0443 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -753,7 +753,7 @@ static void receive_crypto(Net_Crypto *c) | |||
753 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; | 753 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; |
754 | } | 754 | } |
755 | } else if (id_packet(c->lossless_udp, | 755 | } else if (id_packet(c->lossless_udp, |
756 | c->crypto_connections[i].number) != -1) { | 756 | c->crypto_connections[i].number) != (uint8_t)~0) { |
757 | /* This should not happen, timeout the connection if it does. */ | 757 | /* This should not happen, timeout the connection if it does. */ |
758 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; | 758 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; |
759 | } | 759 | } |
@@ -782,7 +782,7 @@ static void receive_crypto(Net_Crypto *c) | |||
782 | /* This should not happen, timeout the connection if it does. */ | 782 | /* This should not happen, timeout the connection if it does. */ |
783 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; | 783 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; |
784 | } | 784 | } |
785 | } else if (id_packet(c->lossless_udp, c->crypto_connections[i].number) != -1) { | 785 | } else if (id_packet(c->lossless_udp, c->crypto_connections[i].number) != (uint8_t)~0) { |
786 | /* This should not happen, timeout the connection if it does. */ | 786 | /* This should not happen, timeout the connection if it does. */ |
787 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; | 787 | c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; |
788 | } | 788 | } |