Lines Matching refs:cs
683 event_conn_state_t *cs = cs_;
684 switch (cs->pub.state) {
842 static void notify_suspend(event_conn_state_t *cs)
844 ap_run_suspend_connection(cs->c, cs->r);
845 cs->suspended = 1;
846 cs->c->sbh = NULL;
849 static void notify_resume(event_conn_state_t *cs, ap_sb_handle_t *sbh)
851 cs->c->sbh = sbh;
852 cs->suspended = 0;
853 ap_run_resume_connection(cs->c, cs->r);
856 static int start_lingering_close_common(event_conn_state_t *cs, int in_worker)
860 apr_socket_t *csd = cs->pfd.desc.s;
869 cs->queue_timestamp = apr_time_now();
875 if (apr_table_get(cs->c->notes, "short-lingering-close")) {
877 cs->pub.state = CONN_STATE_LINGER_SHORT;
881 cs->pub.state = CONN_STATE_LINGER_NORMAL;
885 notify_suspend(cs);
888 cs->c->sbh = NULL;
891 TO_QUEUE_APPEND(q, cs);
892 cs->pfd.reqevents = (
893 cs->pub.sense == CONN_SENSE_WANT_WRITE ? APR_POLLOUT :
895 cs->pub.sense = CONN_SENSE_DEFAULT;
896 rv = apr_pollset_add(event_pollset, &cs->pfd);
902 TO_QUEUE_REMOVE(q, cs);
904 apr_socket_close(cs->pfd.desc.s);
905 ap_push_pool(worker_queue_info, cs->p);
913 * Pre-condition: cs is not in any timeout queue and not in the pollset,
919 static int start_lingering_close_blocking(event_conn_state_t *cs)
921 if (ap_start_lingering_close(cs->c)) {
922 notify_suspend(cs);
923 ap_push_pool(worker_queue_info, cs->p);
926 return start_lingering_close_common(cs, 1);
933 * Pre-condition: cs is not in any timeout queue and not in the pollset,
939 static int start_lingering_close_nonblocking(event_conn_state_t *cs)
941 conn_rec *c = cs->c;
942 apr_socket_t *csd = cs->pfd.desc.s;
948 ap_push_pool(worker_queue_info, cs->p);
951 return start_lingering_close_common(cs, 0);
957 * Pre-condition: cs is not in any timeout queue and not in the pollset
960 static int stop_lingering_close(event_conn_state_t *cs)
963 apr_socket_t *csd = ap_get_conn_socket(cs->c);
971 ap_push_pool(worker_queue_info, cs->p);
982 event_conn_state_t *cs = dummy;
984 if (cs->suspended) {
985 notify_resume(cs, NULL);
997 event_conn_state_t *cs = ap_get_module_config(c->conn_config,
1000 cs->r = NULL;
1006 event_conn_state_t *cs = ap_get_module_config(c->conn_config,
1009 cs->r = r;
1010 cs->sc = ap_get_module_config(ap_server_conf->module_config,
1023 event_conn_state_t *cs = ap_get_module_config(c->conn_config,
1031 cs->sc = ap_get_module_config(r->server->module_config,
1035 cs->sc = ap_get_module_config(c->base_server->module_config,
1045 event_conn_state_t * cs, int my_child_num,
1056 if (cs == NULL) { /* This is a new connection */
1058 cs = apr_pcalloc(p, sizeof(event_conn_state_t));
1059 cs->bucket_alloc = apr_bucket_alloc_create(p);
1061 conn_id, sbh, cs->bucket_alloc);
1067 apr_pool_cleanup_register(c->pool, cs, decrement_connection_count,
1069 ap_set_module_config(c->conn_config, &mpm_event_module, cs);
1071 cs->c = c;
1072 c->cs = &(cs->pub);
1073 cs->p = p;
1074 cs->sc = ap_get_module_config(ap_server_conf->module_config,
1076 cs->pfd.desc_type = APR_POLL_SOCKET;
1077 cs->pfd.reqevents = APR_POLLIN;
1078 cs->pfd.desc.s = sock;
1080 pt->baton = cs;
1081 cs->pfd.client_data = pt;
1082 apr_pool_pre_cleanup_register(p, cs, ptrans_pre_cleanup);
1083 TO_QUEUE_ELEM_INIT(cs);
1099 * it might be better to create the cs on the listener thread
1107 cs->pub.state = CONN_STATE_READ_REQUEST_LINE;
1109 cs->pub.sense = CONN_SENSE_DEFAULT;
1112 c = cs->c;
1113 notify_resume(cs, sbh);
1128 if (cs->pub.state != CONN_STATE_SUSPENDED) {
1129 cs->pub.state = CONN_STATE_LINGER;
1135 if (cs->pub.state == CONN_STATE_READ_REQUEST_LINE) {
1145 cs->pub.state = CONN_STATE_LINGER;
1149 if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
1160 cs->pub.state = CONN_STATE_LINGER;
1167 cs->queue_timestamp = apr_time_now();
1168 notify_suspend(cs);
1170 TO_QUEUE_APPEND(cs->sc->wc_q, cs);
1171 cs->pfd.reqevents = (
1172 cs->pub.sense == CONN_SENSE_WANT_READ ? APR_POLLIN :
1174 cs->pub.sense = CONN_SENSE_DEFAULT;
1175 rc = apr_pollset_add(event_pollset, &cs->pfd);
1181 cs->pub.state = CONN_STATE_LINGER;
1184 cs->pub.state = CONN_STATE_READ_REQUEST_LINE;
1188 cs->pub.state = CONN_STATE_CHECK_REQUEST_LINE_READABLE;
1192 if (cs->pub.state == CONN_STATE_LINGER) {
1193 start_lingering_close_blocking(cs);
1195 else if (cs->pub.state == CONN_STATE_CHECK_REQUEST_LINE_READABLE) {
1204 cs->queue_timestamp = apr_time_now();
1205 notify_suspend(cs);
1207 TO_QUEUE_APPEND(cs->sc->ka_q, cs);
1210 cs->pfd.reqevents = APR_POLLIN;
1211 rc = apr_pollset_add(event_pollset, &cs->pfd);
1220 else if (cs->pub.state == CONN_STATE_SUSPENDED) {
1221 cs->c->suspended_baton = cs;
1223 notify_suspend(cs);
1229 event_conn_state_t* cs = (event_conn_state_t*) c->suspended_baton;
1230 if (cs == NULL) {
1234 } else if (!cs->suspended) {
1243 TO_QUEUE_APPEND(cs->sc->wc_q, cs);
1244 cs->pfd.reqevents = (
1245 cs->pub.sense == CONN_SENSE_WANT_READ ? APR_POLLIN :
1247 cs->pub.sense = CONN_SENSE_DEFAULT;
1248 apr_pollset_add(event_pollset, &cs->pfd);
1388 * Pre-condition: pfd->cs is neither in pollset nor timeout queue
1395 event_conn_state_t *cs = (event_conn_state_t *) pt->baton;
1398 rc = ap_queue_push(worker_queue, cs->pfd.desc.s, cs, cs->p);
1403 apr_bucket_alloc_destroy(cs->bucket_alloc);
1404 apr_socket_close(cs->pfd.desc.s);
1407 ap_push_pool(worker_queue_info, cs->p);
1627 * Pre-condition: cs is in one of the linger queues and in the pollset
1629 static void process_lingering_close(event_conn_state_t *cs, const apr_pollfd_t *pfd)
1631 apr_socket_t *csd = ap_get_conn_socket(cs->c);
1636 q = (cs->pub.state == CONN_STATE_LINGER_SHORT) ? short_linger_q : linger_q;
1655 TO_QUEUE_REMOVE(q, cs);
1657 TO_QUEUE_ELEM_INIT(cs);
1659 ap_push_pool(worker_queue_info, cs->p);
1671 event_conn_state_t *first, *cs, *last;
1683 cs = first = APR_RING_FIRST(&qp->head);
1684 while (cs != APR_RING_SENTINEL(&qp->head, event_conn_state_t,
1697 || cs->queue_timestamp + qp->timeout < timeout_time
1698 || cs->queue_timestamp > timeout_time + qp->timeout)) {
1699 last = cs;
1700 rv = apr_pollset_remove(event_pollset, &cs->pfd);
1702 ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, cs->c, APLOGNO(00473)
1705 cs = APR_RING_NEXT(cs, timeout_list);
1725 cs = APR_RING_NEXT(first, timeout_list);
1728 first = cs;
1875 event_conn_state_t *cs = (event_conn_state_t *) pt->baton;
1876 struct timeout_queue *remove_from_q = cs->sc->wc_q;
1879 switch (cs->pub.state) {
1881 cs->pub.state = CONN_STATE_READ_REQUEST_LINE;
1882 remove_from_q = cs->sc->ka_q;
1890 TO_QUEUE_REMOVE(remove_from_q, cs);
1891 rc = apr_pollset_remove(event_pollset, &cs->pfd);
1903 start_lingering_close_nonblocking(cs);
1907 TO_QUEUE_ELEM_INIT(cs);
1913 start_lingering_close_nonblocking(cs);
1927 process_lingering_close(cs, out_pfd);
1933 cs->pub.state);
2163 event_conn_state_t *cs;
2186 rv = ap_queue_pop_something(worker_queue, &csd, &cs, &ptrans, &te);
2227 process_socket(thd, ptrans, csd, cs, process_slot, thread_slot);