From c249c21fc159451eff0c088ebec00d00dbd3ebaa Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 22 Nov 2018 14:17:33 +0000 Subject: [Fix] Emit error if connection has been terminated with no stop pattern --- src/lua/lua_tcp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index b9406111a..047bfe444 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -895,7 +895,15 @@ lua_tcp_process_read_handler (struct lua_tcp_cbdata *cbd, else { /* Plan new read */ msg_debug_tcp ("NOT found TCP stop pattern"); - lua_tcp_plan_read (cbd); + + if (!cbd->eof) { + lua_tcp_plan_read (cbd); + } + else { + /* Got session finished but no stop pattern */ + lua_tcp_push_error (cbd, TRUE, + "IO read error: connection terminated"); + } } } } @@ -957,7 +965,7 @@ lua_tcp_process_read (struct lua_tcp_cbdata *cbd, lua_tcp_process_read_handler (cbd, rh, TRUE); } else { - lua_tcp_push_error (cbd, FALSE, "IO read error: connection terminated"); + lua_tcp_push_error (cbd, TRUE, "IO read error: connection terminated"); } lua_tcp_plan_handler_event (cbd, FALSE, TRUE); -- cgit v1.2.3