aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-11-27 21:16:47 +0100
committerSverker Eriksson <[email protected]>2018-11-28 20:32:23 +0100
commit0ad63bcc5523f0b560c843b3ed02c08e1369e522 (patch)
tree7fb5b6fc9c4e48e1f8106cc0d1898b6de351103a /erts
parent9103097e3480b5fa8737205793df56c6288f5733 (diff)
downloadotp-0ad63bcc5523f0b560c843b3ed02c08e1369e522.tar.gz
otp-0ad63bcc5523f0b560c843b3ed02c08e1369e522.tar.bz2
otp-0ad63bcc5523f0b560c843b3ed02c08e1369e522.zip
erts: Fix bug in sendfile for active socket
driver_select() was called after port had been killed by tcp_inet_sendfile() calling tcp_send_error().
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/drivers/common/inet_drv.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 259a27cf57..d8491ba18b 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -10204,12 +10204,11 @@ static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd,
desc->tcp_add_flags |= TCP_ADDF_SENDFILE;
/* See if we can finish sending without selecting & rescheduling. */
- tcp_inet_sendfile(desc);
-
- if(desc->sendfile.length > 0) {
- sock_select(INETP(desc), FD_WRITE, 1);
+ if (tcp_inet_sendfile(desc) == 0) {
+ if(desc->sendfile.length > 0) {
+ sock_select(INETP(desc), FD_WRITE, 1);
+ }
}
-
return ctl_reply(INET_REP_OK, NULL, 0, rbuf, rsize);
#else
return ctl_error(ENOTSUP, rbuf, rsize);
@@ -11692,8 +11691,8 @@ socket_error: {
DEBUGF(("tcp_inet_sendfile(%ld): send errno = %d (errno %d)\r\n",
(long)desc->inet.port, socket_errno, errno));
- result = tcp_send_error(desc, socket_errno);
tcp_sendfile_aborted(desc, socket_errno);
+ result = tcp_send_error(desc, socket_errno);
goto done;
}