r646 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Sat Aug 5 10:49:54 CEST 2006


Author: phk
Date: 2006-08-05 10:49:54 +0200 (Sat, 05 Aug 2006)
New Revision: 646

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_event.c
   trunk/varnish-cache/bin/varnishd/mgt_event.h
Log:
bugfixes


Modified: trunk/varnish-cache/bin/varnishd/mgt_event.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_event.c	2006-08-05 08:19:41 UTC (rev 645)
+++ trunk/varnish-cache/bin/varnishd/mgt_event.c	2006-08-05 08:49:54 UTC (rev 646)
@@ -138,7 +138,8 @@
 		    e->flags & (EV_RD|EV_WR|EV_ERR|EV_HUP);
 		e->__poll_idx = evb->lpfd;
 		evb->lpfd++;
-	}
+	} else
+		e->__poll_idx = -1;
 
 	if (e->timeout != 0.0) {
 		e->__when += ev_now() + e->timeout;
@@ -151,7 +152,6 @@
 	e->__evb = evb;
 	e->__binheap_idx = 0;
 	e->__privflags = 0;
-	e->__poll_idx = -1;
 	if (e->fd < 0)
 		TAILQ_INSERT_TAIL(&evb->events, e, __list);
 	else
@@ -196,7 +196,7 @@
 
 	CHECK_OBJ_NOTNULL(evb, EVBASE_MAGIC);
 	do 
-		i = ev_schedule(evb);
+		i = ev_schedule_one(evb);
 	while (i == 1);
 	return (i);
 }
@@ -220,6 +220,7 @@
 	i = e->callback(e, 0);
 	if (i) {
 		ev_del(evb, e);
+		free(e);
 	} else {
 		e->__when += t + e->timeout;
 		binheap_delete(evb->binheap, 0);
@@ -273,7 +274,9 @@
 		assert(pfd->events == e->flags);
 		if (!pfd->revents)
 			continue;
+printf("Call %p %s (%u)\n", e, e->name, pfd->revents);
 		j = e->callback(e, pfd->revents);
+printf("Back from %p %s (%u)\n", e, e->name, pfd->revents);
 		i--;
 		if (evb->disturbed) {
 			TAILQ_FOREACH(e2, &evb->events, __list)
@@ -283,8 +286,10 @@
 			e2 = TAILQ_NEXT(e, __list);
 			evb->disturbed = 0;
 		}
-		if (j)
+		if (j) {
 			ev_del(evb, e);
+			free(e);
+		}
 	}
 	return (1);
 }

Modified: trunk/varnish-cache/bin/varnishd/mgt_event.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_event.h	2006-08-05 08:19:41 UTC (rev 645)
+++ trunk/varnish-cache/bin/varnishd/mgt_event.h	2006-08-05 08:49:54 UTC (rev 646)
@@ -1,4 +1,5 @@
 
+#include <poll.h>
 #include "queue.h"
 
 struct ev;
@@ -11,6 +12,7 @@
 #define EV_MAGIC	0x15c8134b
 
 	/* pub */
+	const char	*name;
 	int		fd;
 	unsigned	flags;
 #define		EV_RD	POLLIN




More information about the varnish-commit mailing list