From 763d862fee5c8d73088e93da0c5a2857eb77afc3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Nov 2005 02:45:28 +0000 Subject: r11712: avoid changing the fde flags unless really needed (This used to be commit 48e6424b0cce38f7d8f212d1e891ff8bbd5fec34) --- source4/lib/stream/packet.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'source4/lib/stream/packet.c') diff --git a/source4/lib/stream/packet.c b/source4/lib/stream/packet.c index 14933ff963..23db44ef02 100644 --- a/source4/lib/stream/packet.c +++ b/source4/lib/stream/packet.c @@ -43,7 +43,7 @@ struct packet_context { void *private; struct fd_event *fde; BOOL serialise; - BOOL processing; + int processing; BOOL recv_disable; BOOL nofree; @@ -209,6 +209,8 @@ void packet_recv(struct packet_context *pc) DATA_BLOB blob; if (pc->processing) { + EVENT_FD_NOT_READABLE(pc->fde); + pc->processing++; return; } @@ -329,15 +331,16 @@ next_partial: pc->packet_size = 0; if (pc->serialise) { - EVENT_FD_NOT_READABLE(pc->fde); - pc->processing = True; + pc->processing = 1; } status = pc->callback(pc->private, blob); - if (pc->serialise) { - EVENT_FD_READABLE(pc->fde); - pc->processing = False; + if (pc->processing) { + if (pc->processing > 1) { + EVENT_FD_READABLE(pc->fde); + } + pc->processing = 0; } if (!NT_STATUS_IS_OK(status)) { -- cgit