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");
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) {