From c762d71cc4b303cc1ed511df090ab92a912fbd24 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 29 Dec 2016 18:56:55 +0000 Subject: [PATCH] [Minor] More fixes for lua_tcp --- src/lua/lua_tcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 2b2a7ce4cf..830d39c957 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -492,12 +492,14 @@ lua_tcp_process_read_handler (struct lua_tcp_cbdata *cbd, memmove (cbd->in->data, cbd->in->data + pos + slen, cbd->in->len - (pos + slen)); lua_tcp_shift_handler (cbd); + cbd->in->len = cbd->in->len - (pos + slen); } else { lua_tcp_shift_handler (cbd); - - return TRUE; + cbd->in->len = 0; } + + return TRUE; } else { /* Plan new read */ @@ -510,6 +512,7 @@ lua_tcp_process_read_handler (struct lua_tcp_cbdata *cbd, msg_debug_tcp ("read TCP partial data"); lua_tcp_push_data (cbd, cbd->in->data, cbd->in->len); lua_tcp_shift_handler (cbd); + cbd->in->len = 0; return TRUE; } -- 2.47.3