- hc = para_calloc(sizeof(struct http_client));
- err_msg = "accept error";
- hc->fd = para_accept(listen_fd, NULL, 0);
- if (hc->fd <= 0)
- goto err_out;
- hc->name = make_message("%s", remote_name(hc->fd));
- PARA_NOTICE_LOG("connection from %s (fd %d)\n", hc->name, hc->fd);
- if (conf.http_max_clients_arg > 0 && numclients >=
- conf.http_max_clients_arg) {
- err_msg = "server full";
- goto err_out;
- }
- match = acl_lookup(hc->fd, &http_acl);
- PARA_DEBUG_LOG("acl lookup returned %d\n", match);
- if ((match && !conf.http_default_deny_given) ||
- (!match && conf.http_default_deny_given)) {
- err_msg = "permission denied";
- goto err_out;
- }
- err_msg = "failed to mark fd non-blocking";
- if (mark_fd_nonblocking(hc->fd) < 0)
- goto err_out;
- hc->status = HTTP_CONNECTED;
- hc->cq = cq_new(MAX_BACKLOG);
- numclients++;
- PARA_INFO_LOG("accepted client #%d: %s (fd %d)\n", numclients,
- hc->name, hc->fd);
- para_list_add(&hc->node, &clients);
- add_close_on_fork_list(hc->fd);
- return;
-err_out:
- PARA_WARNING_LOG("ignoring connect request from %s (%s)\n",
- hc->name, err_msg);
- if (hc->fd > 0)
- close(hc->fd);
- free(hc);
+ sc = accept_sender_client(hss);
+ if (!sc)
+ return;
+ phsd = para_malloc(sizeof(*phsd));
+ sc->private_data = phsd;
+ phsd->status = HTTP_CONNECTED;