aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_tcp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-29 18:56:55 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-12-29 18:58:16 +0000
commitc762d71cc4b303cc1ed511df090ab92a912fbd24 (patch)
tree8c8c54cc22caa4ba99dd3173df508df6ed56e644 /src/lua/lua_tcp.c
parent7bdea713e206959efbf8ffeee544cadd3cfc1a6f (diff)
downloadrspamd-c762d71cc4b303cc1ed511df090ab92a912fbd24.tar.gz
rspamd-c762d71cc4b303cc1ed511df090ab92a912fbd24.zip
[Minor] More fixes for lua_tcp
Diffstat (limited to 'src/lua/lua_tcp.c')
-rw-r--r--src/lua/lua_tcp.c7
1 files changed, 5 insertions, 2 deletions
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;
}