mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Allow sending data after file is paused.
Dissallow sending non requested data.
This commit is contained in:
parent
97d6c4ba18
commit
a377f55b3d
|
@ -1329,9 +1329,6 @@ int file_data(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uin
|
|||
if (ft->status != FILESTATUS_TRANSFERRING)
|
||||
return -4;
|
||||
|
||||
if (ft->paused != FILE_PAUSE_NOT)
|
||||
return -4;
|
||||
|
||||
if (length > MAX_FILE_DATA_SIZE)
|
||||
return -5;
|
||||
|
||||
|
@ -1343,7 +1340,7 @@ int file_data(const Messenger *m, int32_t friendnumber, uint32_t filenumber, uin
|
|||
return -5;
|
||||
}
|
||||
|
||||
if (position != ft->transferred) {
|
||||
if (position != ft->transferred || (ft->requested <= position && ft->size != 0)) {
|
||||
return -7;
|
||||
}
|
||||
|
||||
|
@ -1469,11 +1466,12 @@ static void do_reqchunk_filecb(Messenger *m, int32_t friendnumber)
|
|||
|
||||
++ft->slots_allocated;
|
||||
|
||||
if (m->file_reqchunk)
|
||||
(*m->file_reqchunk)(m, friendnumber, i, ft->requested, length, m->file_reqchunk_userdata);
|
||||
|
||||
uint64_t position = ft->requested;
|
||||
ft->requested += length;
|
||||
|
||||
if (m->file_reqchunk)
|
||||
(*m->file_reqchunk)(m, friendnumber, i, position, length, m->file_reqchunk_userdata);
|
||||
|
||||
--free_slots;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user