Fixed arm bug.

This commit is contained in:
irungentoo 2013-12-12 13:49:49 -05:00
parent 08890a2004
commit cbee548b0a
3 changed files with 7 additions and 7 deletions

View File

@ -480,19 +480,19 @@ uint32_t recvqueue(Lossless_UDP *ludp, int connection_id)
} }
/* return the id of the next packet in the queue. /* return the id of the next packet in the queue.
* return -1 if no packet in queue. * return ~0 if no packet in queue.
*/ */
char id_packet(Lossless_UDP *ludp, int connection_id) uint8_t id_packet(Lossless_UDP *ludp, int connection_id)
{ {
if (recvqueue(ludp, connection_id) == 0) if (recvqueue(ludp, connection_id) == 0)
return -1; return ~0;
Connection *connection = &tox_array_get(&ludp->connections, connection_id, Connection); Connection *connection = &tox_array_get(&ludp->connections, connection_id, Connection);
if (connection->status != LUDP_NO_CONNECTION) if (connection->status != LUDP_NO_CONNECTION)
return connection->recvbuffer[connection->successful_read % connection->recvbuffer_length].data[0]; return connection->recvbuffer[connection->successful_read % connection->recvbuffer_length].data[0];
return -1; return ~0;
} }
/* return 0 if there is no received data in the buffer. /* return 0 if there is no received data in the buffer.

View File

@ -198,7 +198,7 @@ IP_Port connection_ip(Lossless_UDP *ludp, int connection_id);
/* returns the id of the next packet in the queue. /* returns the id of the next packet in the queue.
* return -1 if no packet in queue. * return -1 if no packet in queue.
*/ */
char id_packet(Lossless_UDP *ludp, int connection_id); uint8_t id_packet(Lossless_UDP *ludp, int connection_id);
/* return 0 if there is no received data in the buffer. /* return 0 if there is no received data in the buffer.
* return length of received packet if successful. * return length of received packet if successful.

View File

@ -753,7 +753,7 @@ static void receive_crypto(Net_Crypto *c)
c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT;
} }
} else if (id_packet(c->lossless_udp, } else if (id_packet(c->lossless_udp,
c->crypto_connections[i].number) != -1) { c->crypto_connections[i].number) != (uint8_t)~0) {
/* This should not happen, timeout the connection if it does. */ /* This should not happen, timeout the connection if it does. */
c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT;
} }
@ -782,7 +782,7 @@ static void receive_crypto(Net_Crypto *c)
/* This should not happen, timeout the connection if it does. */ /* This should not happen, timeout the connection if it does. */
c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT;
} }
} else if (id_packet(c->lossless_udp, c->crypto_connections[i].number) != -1) { } else if (id_packet(c->lossless_udp, c->crypto_connections[i].number) != (uint8_t)~0) {
/* This should not happen, timeout the connection if it does. */ /* This should not happen, timeout the connection if it does. */
c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT; c->crypto_connections[i].status = CRYPTO_CONN_TIMED_OUT;
} }