commit a54d04eb8a73d968c0442b14ce82da6add59cd84
parent fff0a763aec09d11c7b5b1aa82f7dc1dfd234997
Author: Joris Vink <joris@coders.se>
Date: Mon, 30 Jun 2014 14:43:34 +0200
Add task glue for BSD as well
Diffstat:
src/bsd.c | | | 31 | ++++++++++++++++++++++++------- |
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/src/bsd.c b/src/bsd.c
@@ -27,6 +27,10 @@
#include "kore_pgsql.h"
#endif
+#if defined(KORE_USE_TASKS)
+#include "kore_tasks.h"
+#endif
+
static int kfd = -1;
static struct kevent *events;
static u_int32_t nchanges;
@@ -108,18 +112,26 @@ kore_platform_event_wait(void)
if (events[i].flags & EV_EOF ||
events[i].flags & EV_ERROR) {
- if (type == KORE_TYPE_LISTENER)
+ switch (type) {
+ case KORE_TYPE_LISTENER:
fatal("error on server socket");
-
+ /* NOTREACHED */
#if defined(KORE_USE_PGSQL)
- if (type == KORE_TYPE_PGSQL_CONN) {
+ case KORE_TYPE_PGSQL_CONN:
kore_pgsql_handle(events[i].udata, 1);
- continue;
- }
+ break;
+#endif
+#if defined(KORE_USE_TASKS)
+ case KORE_TYPE_TASK:
+ kore_task_handle(events[i].udata, 1);
+ break;
#endif
+ default:
+ c = (struct connection *)events[i].udata;
+ kore_connection_disconnect(c);
+ break;
+ }
- c = (struct connection *)events[i].udata;
- kore_connection_disconnect(c);
continue;
}
@@ -165,6 +177,11 @@ kore_platform_event_wait(void)
kore_pgsql_handle(events[i].udata, 0);
break;
#endif
+#if defined(KORE_USE_TASKS)
+ case KORE_TYPE_TASK:
+ kore_task_handle(events[i].udata, 0);
+ break;
+#endif
default:
fatal("wrong type in event %d", type);
}