]> source.dussan.org Git - rspamd.git/commitdiff
Update buffers logic for streaming read.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 6 Jun 2013 16:31:31 +0000 (17:31 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 6 Jun 2013 16:31:31 +0000 (17:31 +0100)
src/buffer.c
src/worker.c

index c81c6a686575c2638de99911c92887904cd9e70d..5912f7040d816aa84b7291ed4db7b0457f6f5961 100644 (file)
@@ -523,9 +523,16 @@ read_buffers (gint fd, rspamd_io_dispatcher_t * d, gboolean skip_read)
        case BUFFER_ANY:
                res.begin = d->in_buf->data->begin;
                res.len = len;
+
                if (d->read_callback) {
-                       if (!d->read_callback (&res, d->user_data)) {
-                               return;
+                       /*
+                        * Actually we do not want to send zero sized
+                        * buffers to a read callback
+                        */
+                       if (! (d->want_read && res.len == 0)) {
+                               if (!d->read_callback (&res, d->user_data)) {
+                                       return;
+                               }
                        }
                        if (d->policy != saved_policy) {
                                debug_ip("policy changed during callback, restart buffer's processing");
index e00ec8d4d44081f34b0dd55c31c731b983ede20b..54cb540d3145748494e8562949d7d8218f51870f 100644 (file)
@@ -308,14 +308,6 @@ read_socket (f_str_t * in, void *arg)
                        task->dispatcher->want_read = FALSE;
                }
                else {
-                       if (task->dispatcher->want_read && in->len == 0) {
-                               /*
-                                * Skip initial zero length string remain from
-                                * buffer policy switch
-                                */
-                               task->dispatcher->want_read = FALSE;
-                               return TRUE;
-                       }
                        task->dispatcher->want_read = FALSE;
                        if (in->len > 0) {
                                if (task->msg->begin == NULL) {