]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] More fixes for lua_tcp
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Dec 2016 18:56:55 +0000 (18:56 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 29 Dec 2016 18:58:16 +0000 (18:58 +0000)
src/lua/lua_tcp.c

index 2b2a7ce4cf869890fc0cd0580bb12bef5666a1e6..830d39c95797aaf00f9b17875e4841917876eb02 100644 (file)
@@ -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;
        }