Let us know if you're using libasyncd
It's always my great pleasure to know how it gets used. Please leave your comment if you're using libasyncd. Many thanks.
@wolkykim i'm trying to use libasyncd - i'm unable to link to the libraries in debian. is there something other than make install i need to do? it copies into /usr/local/[lib|include] but both locate and ldd aren't able to find the libs..
Sorry for late response. I hope you have resolved the issue already. For header files, have you tried to give -I/usr/local/include option to your GCC? Also for library, you need to run ldconfig as root to flush ldconfig cache or you could use LD_LIBRARY_PATH env variable. More detail => http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
Hi TixLo, Thanks for your time providing this. I think it's a valuable feature to this library, a way to provide async return over async message. As you said, this is temporarily code, would you like to make an official patch that we can merge to the main?
Hi Wolkykim, Thanks for your kindly reply and I will make an official path about this issue to you in few days later. Beside the issue, I found a crashing issue. Here is my sample code
I replaced my_conn_handler function with my_https_handler in according to helloworld_http_server.c in helloworld_ssl_server.c but it would crashed when received a HTTPS request. I tried to fixed but failed. Would you check this issue, please? Thanks
ad_server_t *server = ad_server_new();
ad_server_set_option(server, "server.port", "8888");
ad_server_set_option(server, "server.enable_ssl", "1");
ad_server_set_option(server, "server.ssl_cert", "ssl.cert");
ad_server_set_option(server, "server.ssl_pkey", "ssl.pkey");
//ad_server_register_hook(server, my_conn_handler, NULL);
ad_server_register_hook(server, ad_https_handler, NULL); // HTTP Parser is also a hook.
ad_server_register_hook_on_method(server, "POST", my_http_post_handler, NULL);
ad_server_register_hook(server, my_http_default_handler, NULL);
return ad_server_start(server);
the callstack of segmentation fault is below and I tried to return 0 when it happened. It didn't work.
int ad_http_is_keepalive_request(ad_conn_t *conn) {
ad_http_t *http = (ad_http_t *) ad_conn_get_extra(conn); // http is NULL pointer
if (http->request.httpver == NULL) {
return 0;
}
Does it launch a thread in my-https-handler? If then possibily the connection was terminated already and conn was reset? Not sure, can you send me the core dump file and the full code to [email protected]?
Hey @wolkykim, I started learning C this month and wanted to make a server in it. I chose this library after googling because it was small. In theory I could read it and learn. One thing I quickly wanted was a router, so I made a small one. I don't know much C(coming from Python) so the code is probably filled with bugs, I wanted to share my ideas though. Thanks for an awesome library!
#include <asyncd/asyncd.h>
#include <asyncdext/asyncdext.h>
#include <asyncdext/router.h>
int index(short event, ad_conn_t *conn, void *userdata) {
ad_http_response(conn, 200, "text/html", "Home page", 9);
return AD_DONE;
}
int about(short event, ad_conn_t *conn, void *userdata) {
ad_http_response(conn, 200, "text/html", "About page", 10);
return AD_DONE;
}
int main(int argc, char *argv[]) {
ad_server_t *server = ad_server_new();
ad_server_set_option(server, "server.port", "8888");
adext_router_t *router = adext_router_new(2);
adext_router_add(router, "^/$", index);
adext_router_add(router, "^/about/$", about);
ad_server_register_hook(server, ad_http_handler, NULL);
adext_router_register_hook(router, server);
return ad_server_start(server);
}
I think we can add more than one router per server, haven't tried it. I'm planning to add more features.
I'm using it to make a proof of concept for a certain way of deployment & building. Part of it is to expose an HTTPS server interface and one possible implementation is using libasyncd.
Hi, I am trying to use the libasyncd for the embeded application as config server for very few clients <100. after few days of understanding i feel this is well suited for my usage. but i would have loved it it was stand alone app without using libevent & qlibc. FInally when i am porting the app from linux to embeded platform i am stuck at using eventfd which my Glibc version doesnot support.. it would be great if some guidance is being provided..