Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
3171-Move-empty-send-shortcut-to-not-interfere-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3171-Move-empty-send-shortcut-to-not-interfere-with-send_.patch of Package erlang
From 9c01190706fc4920d6826281e42cf9dff2dd3120 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Mon, 3 Jan 2022 17:30:37 +0100 Subject: [PATCH 1/2] Move empty send shortcut to not interfere with send_timeout --- erts/emulator/drivers/common/inet_drv.c | 31 ++++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 49db7077de..b007d1d2d5 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -10633,7 +10633,7 @@ static void tcp_inet_commandv(ErlDrvData e, ErlIOVec* ev) tcp_descriptor* desc = (tcp_descriptor*)e; desc->inet.caller = driver_caller(desc->inet.port); - DEBUGF(("tcp_inet_commanv(%p) {s=%d\r\n", + DEBUGF(("tcp_inet_commandv(%p) {s=%d\r\n", desc->inet.port, desc->inet.s)); if (!IS_CONNECTED(INETP(desc))) { if (desc->tcp_add_flags & TCP_ADDF_DELAYED_CLOSE_SEND) { @@ -11607,8 +11607,6 @@ static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev) h_len = 4; break; default: - if (len == 0) - return 0; h_len = 0; break; } @@ -11626,6 +11624,11 @@ static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev) if ((desc->tcp_add_flags & TCP_ADDF_SENDFILE) || sz > 0) { driver_enqv(ix, ev, 0); if (sz+ev->size >= desc->high) { + if (desc->send_timeout == 0) { + /* Shortcut to speed up polling of high water mark */ + inet_reply_error_am(INETP(desc), am_timeout); + return 1; + } DEBUGF(("tcp_sendv(%p): s=%d, sender forced busy\r\n", desc->inet.port, desc->inet.s)); desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ @@ -11641,9 +11644,13 @@ static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev) } } else { - int vsize = (ev->vsize > MAX_VSIZE) ? MAX_VSIZE : ev->vsize; + int vsize; - DEBUGF(("tcp_sendv(%p): s=%d, " + if ((h_len == 0) && (len == 0)) /* Shortcut for empty send */ + return 0; + vsize = (ev->vsize > MAX_VSIZE) ? MAX_VSIZE : ev->vsize; + + DEBUGF(("tcp_sendv(%p): s=%d, " "about to send "LLU","LLU" bytes\r\n", desc->inet.port, desc->inet.s, (llu_t)h_len, (llu_t)len)); @@ -11695,7 +11702,7 @@ static int tcp_sendv(tcp_descriptor* desc, ErlIOVec* ev) */ static int tcp_send(tcp_descriptor* desc, char* ptr, ErlDrvSizeT len) { - int sz; + ErlDrvSizeT sz; char buf[4]; int h_len; int n; @@ -11716,8 +11723,6 @@ static int tcp_send(tcp_descriptor* desc, char* ptr, ErlDrvSizeT len) h_len = 4; break; default: - if (len == 0) - return 0; h_len = 0; break; } @@ -11731,6 +11736,11 @@ static int tcp_send(tcp_descriptor* desc, char* ptr, ErlDrvSizeT len) driver_enq(ix, buf, h_len); driver_enq(ix, ptr, len); if (sz+h_len+len >= desc->high) { + if (desc->send_timeout == 0) { + /* Shortcut to speed up polling of high water mark */ + inet_reply_error_am(INETP(desc), am_timeout); + return 1; + } DEBUGF(("tcp_send(%p): s=%d, sender forced busy\r\n", desc->inet.port, desc->inet.s)); desc->inet.state |= INET_F_BUSY; /* mark for low-watermark */ @@ -11746,6 +11756,9 @@ static int tcp_send(tcp_descriptor* desc, char* ptr, ErlDrvSizeT len) } } else { + if ((h_len == 0) && (len == 0)) /* Shortcut for empty send */ + return 0; + iov[0].iov_base = buf; iov[0].iov_len = h_len; iov[1].iov_base = ptr; -- 2.34.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor