Kill all file transfers associated with the friend when friend goes

offline.
This commit is contained in:
irungentoo 2015-03-17 17:23:47 -04:00
parent 0beaa2fdb4
commit ad87dbb470
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98

View File

@ -1515,19 +1515,20 @@ static void do_reqchunk_filecb(Messenger *m, int32_t friendnumber)
} }
/* Run this when the friend disconnects. /* Run this when the friend disconnects.
* Sets all current file transfers to broken. * Kill all current file transfers.
*/ */
static void break_files(const Messenger *m, int32_t friendnumber) static void break_files(const Messenger *m, int32_t friendnumber)
{ {
uint32_t i; uint32_t i;
/* TODO
//TODO: Inform the client which file transfers get killed with a callback?
for (i = 0; i < MAX_CONCURRENT_FILE_PIPES; ++i) { for (i = 0; i < MAX_CONCURRENT_FILE_PIPES; ++i) {
if (m->friendlist[friendnumber].file_sending[i].status != FILESTATUS_NONE) if (m->friendlist[friendnumber].file_sending[i].status != FILESTATUS_NONE)
m->friendlist[friendnumber].file_sending[i].status = FILESTATUS_BROKEN; m->friendlist[friendnumber].file_sending[i].status = FILESTATUS_NONE;
if (m->friendlist[friendnumber].file_receiving[i].status != FILESTATUS_NONE) if (m->friendlist[friendnumber].file_receiving[i].status != FILESTATUS_NONE)
m->friendlist[friendnumber].file_receiving[i].status = FILESTATUS_BROKEN; m->friendlist[friendnumber].file_receiving[i].status = FILESTATUS_NONE;
}*/ }
} }
/* return -1 on failure, 0 on success. /* return -1 on failure, 0 on success.