summaryrefslogtreecommitdiff
path: root/toxcore/Lossless_UDP.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/Lossless_UDP.c')
-rw-r--r--toxcore/Lossless_UDP.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c
index 53cdea09..d82c3e27 100644
--- a/toxcore/Lossless_UDP.c
+++ b/toxcore/Lossless_UDP.c
@@ -461,6 +461,20 @@ uint32_t sendqueue(Lossless_UDP *ludp, int connection_id)
461 return connection->sendbuff_packetnum - connection->successful_sent; 461 return connection->sendbuff_packetnum - connection->successful_sent;
462} 462}
463 463
464/* return number of packets in all queues waiting to be successfully sent. */
465uint32_t sendqueue_total(Lossless_UDP *ludp)
466{
467 uint32_t total = 0;
468 int i;
469 for(i = 0; i < ludp->connections.len; i++) {
470 Connection *connection = &tox_array_get(&ludp->connections, i, Connection);
471 if (connection->status != 0)
472 total += connection->sendbuff_packetnum - connection->successful_sent;
473 }
474
475 return total;
476}
477
464/* return the number of packets in the queue waiting to be successfully read with read_packet(...). */ 478/* return the number of packets in the queue waiting to be successfully read with read_packet(...). */
465uint32_t recvqueue(Lossless_UDP *ludp, int connection_id) 479uint32_t recvqueue(Lossless_UDP *ludp, int connection_id)
466{ 480{