- upoll_on_readable(hsrv->upoll, NULL);
- MHD_run(hsrv->httpd);
- upoll_on_readable(hsrv->upoll, (void*)handle_epoll_readable);
-};
+ MHD_UNSIGNED_LONG_LONG to;
+ struct afb_hsrv *hsrv = arg;
+
+ if (!signum) {
+ do { MHD_run(hsrv->httpd); } while(MHD_get_timeout(hsrv->httpd, &to) == MHD_YES && !to);
+ }
+ fdev_set_events(hsrv->fdev, EPOLLIN);
+}
+
+void run_micro_httpd(struct afb_hsrv *hsrv)
+{
+ fdev_set_events(hsrv->fdev, 0);
+ if (jobs_queue(hsrv, 0, do_run, hsrv) < 0)
+ do_run(0, hsrv);
+}
+
+static void listen_callback(void *hsrv, uint32_t revents, struct fdev *fdev)
+{
+ run_micro_httpd(hsrv);
+}