aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-11-25 11:12:36 +0100
committerLukas Larsson <[email protected]>2011-12-01 14:10:03 +0100
commit1087d64af63d1fd5044d56e864557365ed40aab3 (patch)
tree1e858a2cba99abf5ce0bc0e430f9297939a81867 /erts/emulator/drivers
parent8e653ead2f361ce37b6e00b85844a48bd0cab394 (diff)
downloadotp-1087d64af63d1fd5044d56e864557365ed40aab3.tar.gz
otp-1087d64af63d1fd5044d56e864557365ed40aab3.tar.bz2
otp-1087d64af63d1fd5044d56e864557365ed40aab3.zip
Fix cleanup for sendfile
Diffstat (limited to 'erts/emulator/drivers')
-rw-r--r--erts/emulator/drivers/common/efile_drv.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index 0364d0722a..98da63f4e3 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -1772,7 +1772,7 @@ static void file_ready_output(ErlDrvData data, ErlDrvEvent event)
driver_select(fd->port, (ErlDrvEvent)fd->d->c.sendfile.out_fd,
(int)ERL_DRV_WRITE,(int) 0);
invoke_sendfile((void *)fd->d);
- file_async_ready((ErlDrvData)fd, (ErlDrvThreadData)fd->d);
+ file_async_ready(data, (ErlDrvThreadData)fd->d);
break;
default:
break;
@@ -2203,15 +2203,19 @@ file_async_ready(ErlDrvData e, ErlDrvThreadData data)
reply_error(desc, &d->errInfo);
if (sys_info.async_threads != 0) {
SET_NONBLOCKING(d->c.sendfile.out_fd);
+ } else {
+ driver_select(desc->port, (ErlDrvEvent)d->c.sendfile.out_fd,
+ ERL_DRV_USE, 0);
}
- free_sendfile(data);
} else if (d->result_ok == 0) {
desc->sendfile_state = not_sending;
reply_Sint64(desc, d->c.sendfile.written);
if (sys_info.async_threads != 0) {
SET_NONBLOCKING(d->c.sendfile.out_fd);
+ } else {
+ driver_select(desc->port, (ErlDrvEvent)d->c.sendfile.out_fd,
+ ERL_DRV_USE, 0);
}
- free_sendfile(data);
} else if (d->result_ok == 1) { // If we are using select to send the rest of the data
desc->sendfile_state = sending;
desc->d = d;
@@ -3389,7 +3393,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
d->fd = desc->fd;
d->command = command;
d->invoke = invoke_sendfile;
- d->free = free_sendfile;
+ d->free = NULL;
d->level = 2;
d->c.sendfile.out_fd = (int) out_fd;
@@ -3422,6 +3426,7 @@ file_outputv(ErlDrvData e, ErlIOVec *ev) {
if (sys_info.async_threads != 0) {
SET_BLOCKING(d->c.sendfile.out_fd);
+ d->free = free_sendfile;
}
cq_enq(desc, d);