| 813 | } |
| 814 | |
| 815 | conn_rec *h2_c2_create(conn_rec *c1, apr_pool_t *parent, |
| 816 | apr_bucket_alloc_t *buckt_alloc) |
| 817 | { |
| 818 | apr_pool_t *pool; |
| 819 | conn_rec *c2; |
| 820 | void *cfg; |
| 821 | |
| 822 | ap_assert(c1); |
| 823 | ap_log_cerror(APLOG_MARK, APLOG_TRACE3, 0, c1, |
| 824 | "h2_c2: create for c1(%ld)", c1->id); |
| 825 | |
| 826 | /* We create a pool with its own allocator to be used for |
| 827 | * processing a request. This is the only way to have the processing |
| 828 | * independent of its parent pool in the sense that it can work in |
| 829 | * another thread. |
| 830 | */ |
| 831 | apr_pool_create(&pool, parent); |
| 832 | apr_pool_tag(pool, "h2_c2_conn"); |
| 833 | |
| 834 | c2 = (conn_rec *) apr_palloc(pool, sizeof(conn_rec)); |
| 835 | memcpy(c2, c1, sizeof(conn_rec)); |
| 836 | |
| 837 | c2->master = c1; |
| 838 | c2->pool = pool; |
| 839 | c2->conn_config = ap_create_conn_config(pool); |
| 840 | c2->notes = apr_table_make(pool, 5); |
| 841 | c2->input_filters = NULL; |
| 842 | c2->output_filters = NULL; |
| 843 | c2->keepalives = 0; |
| 844 | #if AP_MODULE_MAGIC_AT_LEAST(20180903, 1) |
| 845 | c2->filter_conn_ctx = NULL; |
| 846 | #endif |
| 847 | c2->bucket_alloc = apr_bucket_alloc_create(pool); |
| 848 | #if !AP_MODULE_MAGIC_AT_LEAST(20180720, 1) |
| 849 | c2->data_in_input_filters = 0; |
| 850 | c2->data_in_output_filters = 0; |
| 851 | #endif |
| 852 | /* prevent mpm_event from making wrong assumptions about this connection, |
| 853 | * like e.g. using its socket for an async read check. */ |
| 854 | c2->clogging_input_filters = 1; |
| 855 | c2->log = NULL; |
| 856 | c2->aborted = 0; |
| 857 | /* We cannot install the master connection socket on the secondary, as |
| 858 | * modules mess with timeouts/blocking of the socket, with |
| 859 | * unwanted side effects to the master connection processing. |
| 860 | * Fortunately, since we never use the secondary socket, we can just install |
| 861 | * a single, process-wide dummy and everyone is happy. |
| 862 | */ |
| 863 | ap_set_module_config(c2->conn_config, &core_module, dummy_socket); |
| 864 | /* TODO: these should be unique to this thread */ |
| 865 | c2->sbh = NULL; /*c1->sbh;*/ |
| 866 | /* TODO: not all mpm modules have learned about secondary connections yet. |
| 867 | * copy their config from master to secondary. |
| 868 | */ |
| 869 | if (mpm_module) { |
| 870 | cfg = ap_get_module_config(c1->conn_config, mpm_module); |
| 871 | ap_set_module_config(c2->conn_config, mpm_module, cfg); |
| 872 | } |
no test coverage detected