afb_hreq_free(hreq);
}
+static void handle_epoll_readable(struct afb_hsrv *hsrv)
+{
+ upoll_on_readable(hsrv->upoll, NULL);
+ MHD_run(hsrv->httpd);
+ upoll_on_readable(hsrv->upoll, (void*)handle_epoll_readable);
+};
+
static int new_client_handler(void *cls, const struct sockaddr *addr, socklen_t addrlen)
{
return MHD_YES;
MHD_OPTION_END); /* options-end */
if (httpd == NULL) {
- printf("Error: httpStart invalid httpd port: %d", (int)port);
+ fprintf(stderr, "Error: httpStart invalid httpd port: %d", (int)port);
return 0;
}
return 0;
}
- upoll = upoll_open(info->listen_fd, httpd);
+ upoll = upoll_open(info->listen_fd, hsrv);
if (upoll == NULL) {
MHD_stop_daemon(httpd);
fprintf(stderr, "Error: connection to upoll of httpd failed");
return 0;
}
- upoll_on_readable(upoll, (void*)MHD_run);
+ upoll_on_readable(upoll, (void*)handle_epoll_readable);
hsrv->httpd = httpd;
hsrv->upoll = upoll;