From: Vsevolod Stakhov Date: Thu, 29 Dec 2016 18:56:55 +0000 (+0000) Subject: [Minor] More fixes for lua_tcp X-Git-Tag: 1.5.0~458 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c762d71cc4b303cc1ed511df090ab92a912fbd24;p=rspamd.git [Minor] More fixes for lua_tcp --- diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 2b2a7ce4c..830d39c95 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; }