X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fhttp.c;h=8321bb3b818f4966738cfa19af23431191534906;hb=f9fd1939f30660831f6390a91839357133e005ea;hp=5158ddbd1929e0c2b3532b64d1ea6ed043d687b2;hpb=d24d65a3a42bbb6e8c8d0f919bf33510dd356a45;p=pazpar2-moved-to-github.git diff --git a/src/http.c b/src/http.c index 5158ddb..8321bb3 100644 --- a/src/http.c +++ b/src/http.c @@ -63,7 +63,8 @@ typedef int socklen_t; #include #include -#include "pazpar2.h" +#include "ppmutex.h" +#include "session.h" #include "http.h" #define MAX_HTTP_HEADER 4096 @@ -797,7 +798,7 @@ static int http_proxy(struct http_request *rq) p->first_response = 1; c->proxy = p; // We will add EVENT_OUTPUT below - p->iochan = iochan_create(sock, proxy_io, EVENT_INPUT); + p->iochan = iochan_create(sock, proxy_io, EVENT_INPUT, "http_proxy"); iochan_setdata(p->iochan, p); iochan_add(ser->iochan_man, p->iochan); @@ -1170,7 +1171,7 @@ static void http_accept(IOCHAN i, int event) enable_nonblock(s); yaz_log(YLOG_DEBUG, "New command connection"); - c = iochan_create(s, http_io, EVENT_INPUT | EVENT_EXCEPT); + c = iochan_create(s, http_io, EVENT_INPUT | EVENT_EXCEPT, "http_session_socket"); ch = http_channel_create(server->http_server, inet_ntoa(addr.sin_addr), server); @@ -1245,7 +1246,7 @@ int http_init(const char *addr, struct conf_server *server) server->http_server->listener_socket = l; - c = iochan_create(l, http_accept, EVENT_INPUT | EVENT_EXCEPT); + c = iochan_create(l, http_accept, EVENT_INPUT | EVENT_EXCEPT, "http_server"); iochan_setdata(c, server); iochan_add(server->iochan_man, c); @@ -1373,14 +1374,9 @@ void http_server_destroy(http_server_t hs) { int r; - if (hs->mutex) - { - yaz_mutex_enter(hs->mutex); - r = --(hs->ref_count); - yaz_mutex_leave(hs->mutex); - } - else - r = --(hs->ref_count); + yaz_mutex_enter(hs->mutex); /* OK: hs->mutex may be NULL */ + r = --(hs->ref_count); + yaz_mutex_leave(hs->mutex); if (r == 0) { @@ -1421,7 +1417,7 @@ void http_mutex_init(struct conf_server *server) assert(server); assert(server->http_server->mutex == 0); - yaz_mutex_create(&server->http_server->mutex); + pazpar2_mutex_create(&server->http_server->mutex, "http_server"); server->http_server->http_sessions = http_sessions_create(); }