- upoll_on_readable(hsrv->upoll, NULL);
- MHD_run(hsrv->httpd);
- upoll_on_readable(hsrv->upoll, (void*)handle_epoll_readable);
-};
+ if (hsrv->in_run != 0)
+ hsrv->in_run = 2;
+ else {
+ sd_event_source_set_io_events(hsrv->evsrc, 0);
+ do {
+ hsrv->in_run = 1;
+ MHD_run(hsrv->httpd);
+ } while(hsrv->in_run == 2);
+ hsrv->in_run = 0;
+ sd_event_source_set_io_events(hsrv->evsrc, EPOLLIN);
+ }
+}
+
+static int io_event_callback(sd_event_source *src, int fd, uint32_t revents, void *hsrv)
+{
+ run_micro_httpd(hsrv);
+ return 0;
+}