Browse Source

let kqueue startup after daemonize is done

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@650 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.3
Jan Kneschke 17 years ago
parent
commit
e47ae00886
  1. 4
      src/connections.c
  2. 10
      src/fdevent_freebsd_kqueue.c
  3. 4
      src/network.c
  4. 6
      src/server.c

4
src/connections.c

@ -1064,7 +1064,6 @@ handler_t connection_handle_fdevent(void *s, void *context, int revents) {
connection *connection_accept(server *srv, server_socket *srv_socket) {
int accepted_requests = 0;
/* accept everything */
/* search an empty place */
@ -1078,7 +1077,7 @@ connection *connection_accept(server *srv, server_socket *srv_socket) {
if (-1 == (cnt = accept(srv_socket->fd, (struct sockaddr *) &cnt_addr, &cnt_len))) {
if ((errno != EAGAIN) &&
(errno != EINTR)) {
log_error_write(srv, __FILE__, __LINE__, "ss", "accept failed: ", strerror(errno));
log_error_write(srv, __FILE__, __LINE__, "ssd", "accept failed:", strerror(errno), errno);
}
return NULL;
} else {
@ -1086,7 +1085,6 @@ connection *connection_accept(server *srv, server_socket *srv_socket) {
srv->cur_fds++;
accepted_requests++;
/* ok, we have the connection, register it */
#if 0
log_error_write(srv, __FILE__, __LINE__, "sd",

10
src/fdevent_freebsd_kqueue.c

@ -149,8 +149,6 @@ static int fdevent_freebsd_kqueue_event_next_fdndx(fdevents *ev, int ndx) {
}
static int fdevent_freebsd_kqueue_reset(fdevents *ev) {
close(ev->kq_fd);
if (-1 == (ev->kq_fd = kqueue())) {
fprintf(stderr, "%s.%d: kqueue failed (%s), try to set server.event-handler = \"poll\" or \"select\"\n",
__FILE__, __LINE__, strerror(errno));
@ -178,12 +176,8 @@ int fdevent_freebsd_kqueue_init(fdevents *ev) {
SET(event_get_fd);
SET(event_get_revent);
if (-1 == (ev->kq_fd = kqueue())) {
fprintf(stderr, "%s.%d: kqueue failed (%s), try to set server.event-handler = \"poll\" or \"select\"\n",
__FILE__, __LINE__, strerror(errno));
return -1;
}
ev->kq_fd = -1;
ev->kq_results = calloc(ev->maxfds, sizeof(*ev->kq_results));
ev->kq_bevents = bitset_init(ev->maxfds);

4
src/network.c

@ -406,7 +406,9 @@ int network_init(server *srv) {
int network_register_fdevents(server *srv) {
size_t i;
fdevent_reset(srv->ev);
if (-1 == fdevent_reset(srv->ev)) {
return -1;
}
/* register fdevents after reset */
for (i = 0; i < srv->srv_sockets.used; i++) {

6
src/server.c

@ -670,7 +670,11 @@ int main (int argc, char **argv) {
return -1;
}
/* kqueue needs a reset AFTER daemonize() */
/*
* kqueue() is called here, select resets its internals,
* all server sockets get their handlers
*
* */
if (0 != network_register_fdevents(srv)) {
plugins_free(srv);
network_close(srv);

Loading…
Cancel
Save