From 2e609c46f68964a78dffe0b8ec39ae54149a9f94 Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Thu, 25 Feb 2016 17:58:02 -0500 Subject: [PATCH] Remove file transfer timeoutes, and remove a couple unused functions --- src/chat.c | 27 --------------------------- src/file_transfers.c | 41 ----------------------------------------- src/file_transfers.h | 4 ---- src/toxic.c | 1 - 4 files changed, 73 deletions(-) diff --git a/src/chat.c b/src/chat.c index b141d15..dbf8949 100644 --- a/src/chat.c +++ b/src/chat.c @@ -774,33 +774,6 @@ void chat_onEnd (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state) #endif /* SOUND_NOTIFY */ } -void chat_onRequestTimeout (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state) -{ - if (!self || self->num != friend_number) - return; - - self->is_call = false; - line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "No answer!"); - -#ifdef SOUND_NOTIFY - stop_sound(self->ringing_sound); -#endif /* SOUND_NOTIFY */ -} - -void chat_onPeerTimeout (ToxWindow *self, ToxAV *av, uint32_t friend_number, int state) -{ - if (!self || self->num != friend_number) - return; - - self->is_call = false; - kill_infobox(self); - line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Peer disconnected; call ended!"); - -#ifdef SOUND_NOTIFY - stop_sound(self->ringing_sound); -#endif /* SOUND_NOTIFY */ -} - static void init_infobox(ToxWindow *self) { ChatContext *ctx = self->chatwin; diff --git a/src/file_transfers.c b/src/file_transfers.c index 3a06742..ad71c9e 100644 --- a/src/file_transfers.c +++ b/src/file_transfers.c @@ -38,47 +38,6 @@ extern FriendsList Friends; /* number of "#"'s in file transfer progress bar. Keep well below MAX_STR_SIZE */ #define NUM_PROG_MARKS 50 -/* Checks for timed out file transfers and closes them. */ -#define CHECK_FILE_TIMEOUT_INTERAVAL 5 - -void check_file_transfer_timeouts(Tox *m) -{ - char msg[MAX_STR_SIZE]; - static uint64_t last_check = 0; - - if (!timed_out(last_check, CHECK_FILE_TIMEOUT_INTERAVAL)) - return; - - last_check = get_unix_time(); - - size_t i, j; - - for (i = 0; i < Friends.max_idx; ++i) { - if (!Friends.list[i].active) - continue; - - for (j = 0; j < MAX_FILES; ++j) { - struct FileTransfer *ft_send = &Friends.list[i].file_sender[j]; - - if (ft_send->state > FILE_TRANSFER_PAUSED) { - if (timed_out(ft_send->last_keep_alive, TIMEOUT_FILESENDER)) { - snprintf(msg, sizeof(msg), "File transfer for '%s' timed out.", ft_send->file_name); - close_file_transfer(ft_send->window, m, ft_send, TOX_FILE_CONTROL_CANCEL, msg, notif_error); - } - } - - struct FileTransfer *ft_recv = &Friends.list[i].file_receiver[j]; - - if (ft_recv->state > FILE_TRANSFER_PAUSED) { - if (timed_out(ft_recv->last_keep_alive, TIMEOUT_FILESENDER)) { - snprintf(msg, sizeof(msg), "File transfer for '%s' timed out.", ft_recv->file_name); - close_file_transfer(ft_recv->window, m, ft_recv, TOX_FILE_CONTROL_CANCEL, msg, notif_error); - } - } - } - } -} - /* creates initial progress line that will be updated during file transfer. Assumes progline has room for at least MAX_STR_SIZE bytes */ void init_progress_bar(char *progline) diff --git a/src/file_transfers.h b/src/file_transfers.h index f5181a6..aaf081e 100644 --- a/src/file_transfers.h +++ b/src/file_transfers.h @@ -34,7 +34,6 @@ #define GiB 1073741824 /* 1024^3 */ #define MAX_FILES 32 -#define TIMEOUT_FILESENDER 120 typedef enum FILE_TRANSFER_STATE { FILE_TRANSFER_INACTIVE, @@ -68,9 +67,6 @@ struct FileTransfer { uint8_t file_id[TOX_FILE_ID_LENGTH]; }; -/* Checks for timed out file transfers and closes them. */ -void check_file_transfer_timeouts(Tox *m); - /* creates initial progress line that will be updated during file transfer. progline must be at lesat MAX_STR_SIZE bytes */ void init_progress_bar(char *progline); diff --git a/src/toxic.c b/src/toxic.c index bdf8f9e..4fb533a 100644 --- a/src/toxic.c +++ b/src/toxic.c @@ -887,7 +887,6 @@ static void do_toxic(Tox *m, ToxWindow *prompt) tox_iterate(m); do_bootstrap(m); - check_file_transfer_timeouts(m); pthread_mutex_unlock(&Winthread.lock); }