diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-18 13:56:17 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-10-18 13:56:17 +0100 |
commit | 705ef63d5d0505baeadd17da4e9e5986d937a028 (patch) | |
tree | 418a57224a7f54d4e72f1ae35602f2485026f71a /src | |
parent | b07f3cc2e4fa873590d6d028c9ce03ecc926d9f4 (diff) | |
download | rspamd-705ef63d5d0505baeadd17da4e9e5986d937a028.tar.gz rspamd-705ef63d5d0505baeadd17da4e9e5986d937a028.zip |
[Fix] Lua_tcp: Deal with temporary fails on write
Issue: #3097
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_tcp.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 335d770d5..09d572199 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -850,12 +850,19 @@ lua_tcp_write_helper (struct lua_tcp_cbdata *cbd) if (r == -1) { if (!(cbd->ssl_conn)) { - lua_tcp_push_error (cbd, TRUE, - "IO write error while trying to write %d bytes: %s", - (gint) remain, strerror (errno)); + if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + msg_debug_tcp ("got temporary failure, retry write"); + lua_tcp_plan_handler_event (cbd, TRUE, TRUE); + return; + } + else { + lua_tcp_push_error (cbd, TRUE, + "IO write error while trying to write %d bytes: %s", + (gint) remain, strerror (errno)); - msg_debug_tcp ("write error, terminate connection"); - TCP_RELEASE (cbd); + msg_debug_tcp ("write error, terminate connection"); + TCP_RELEASE (cbd); + } } return; |