summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2014-09-27 16:58:35 +0100
committersin <sin@2f30.org>2014-09-27 16:59:43 +0100
commit388273ecb3c78e742186f3dd2d3227787b407750 (patch)
treec92635b10f941c47c443b4067d73a41dfe031762 /ratox.c
parent2577db3a2d138218f1f0ca649178a7bc692442af (diff)
Clear fd status when we are done to avoid double initiation
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ratox.c b/ratox.c
index a85a87e..6e09474 100644
--- a/ratox.c
+++ b/ratox.c
@@ -605,7 +605,7 @@ sendfriendfile(struct friend *f)
if (n == 0) {
/* Signal transfer completion to other end */
if (tox_file_send_control(tox, f->num, 0, f->tx.fnum,
- TOX_FILECONTROL_FINISHED, NULL, 0) < 0)
+ TOX_FILECONTROL_FINISHED, NULL, 0) < 0)
weprintf("Failed to signal transfer completion to the receiver\n");
f->tx.state = TRANSFER_NONE;
break;
@@ -1203,6 +1203,8 @@ loop(void)
continue;
if (f->tx.pendingbuf == 1)
sendfriendfile(f);
+ if (f->tx.state == TRANSFER_NONE)
+ FD_CLR(f->fd[FFILE_IN], &rfds);
}
/* Accept pending transfers if any */