From 3ed49ebb30e71a1575391dd50317e7859273de0b Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 15 Oct 2014 12:36:38 +0100 Subject: Remember to cool down the transfer for pending buffers as well This change halves CPU usage on my system. --- ratox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ratox.c b/ratox.c index 32c645e..4df6909 100644 --- a/ratox.c +++ b/ratox.c @@ -925,7 +925,8 @@ sendfriendfile(struct friend *f) /* Attempt to transmit the pending buffer */ if (f->tx.pendingbuf == 1) { if (tox_file_send_data(tox, f->num, f->tx.fnum, f->tx.buf, f->tx.n) == -1) { - /* bad luck - we will try again later */ + clock_gettime(CLOCK_MONOTONIC, &f->tx.lastblock); + f->tx.cooldown = 1; break; } f->tx.pendingbuf = 0; -- cgit v1.2.3