tDetect and cleanup stale transfers - ratox - FIFO based tox client
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit eab089bc9420386a38dfa01872edc62480f4e27f
 (DIR) parent 0c916898347ff1887801443526f20136190a947d
 (HTM) Author: sin <sin@2f30.org>
       Date:   Tue, 16 Sep 2014 13:53:40 +0100
       
       Detect and cleanup stale transfers
       
       Diffstat:
         M ratatox.c                           |      13 +++++++++++++
       
       1 file changed, 13 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/ratatox.c b/ratatox.c
       t@@ -911,6 +911,19 @@ loop(void)
                                exit(EXIT_FAILURE);
                        }
        
       +                /* Check for broken transfers, i.e. the friend went offline
       +                 * in the middle of a transfer.
       +                 */
       +                TAILQ_FOREACH(f, &friendhead, entry) {
       +                        if (tox_get_friend_connection_status(tox, f->fid) == 0) {
       +                                if (f->t.state != TRANSFER_NONE) {
       +                                        printout("Stale transfer detected, friend offline\n");
       +                                        f->t.state = TRANSFER_NONE;
       +                                        free(f->t.buf);
       +                                }
       +                        }
       +                }
       +
                        /* If we hit the receiver too hard, we will run out of
                         * local buffer slots.  In that case tox_file_send_data()
                         * will return -1 and we will have to queue the buffer to