Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h2_mplx.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __mod_h2__h2_mplx__
18 #define __mod_h2__h2_mplx__
19 
40 struct apr_pool_t;
41 struct apr_thread_mutex_t;
42 struct apr_thread_cond_t;
43 struct h2_bucket_beam;
44 struct h2_config;
45 struct h2_ihash_t;
46 struct h2_task;
47 struct h2_stream;
48 struct h2_request;
49 struct apr_thread_cond_t;
50 struct h2_workers;
51 struct h2_iqueue;
52 
53 #include <apr_queue.h>
54 
55 typedef struct h2_mplx h2_mplx;
56 
57 struct h2_mplx {
58  long id;
61  server_rec *s; /* server for master conn */
62 
63  unsigned int event_pending;
64  unsigned int aborted;
65  unsigned int is_registered; /* is registered at h2_workers */
66 
67  struct h2_ihash_t *streams; /* all streams currently processing */
68  struct h2_ihash_t *shold; /* all streams done with task ongoing */
69  struct h2_ihash_t *spurge; /* all streams done, ready for destroy */
70 
71  struct h2_iqueue *q; /* all stream ids that need to be started */
72  struct h2_ififo *readyq; /* all stream ids ready for output */
73 
74  struct h2_ihash_t *redo_tasks; /* all tasks that need to be redone */
75 
76  int max_streams; /* max # of concurrent streams */
77  int max_stream_started; /* highest stream id that started processing */
78  int tasks_active; /* # of tasks being processed from this mplx */
79  int limit_active; /* current limit on active tasks, dynamic */
80  int max_active; /* max, hard limit # of active tasks in a process */
81 
82  apr_time_t last_mood_change; /* last time, we worker limit changed */
83  apr_interval_time_t mood_update_interval; /* how frequent we update at most */
84  int irritations_since; /* irritations (>0) or happy events (<0) since last mood change */
85 
89 
91 
93  apr_array_header_t *spare_secondary; /* spare secondary connections */
94 
96 };
97 
98 /*******************************************************************************
99  * From the main connection processing: h2_mplx_m_*
100  ******************************************************************************/
101 
103 
109  struct h2_workers *workers);
110 
120 
127 
136 
142  struct apr_thread_cond_t *iowait);
143 
145 
155 apr_status_t h2_mplx_m_process(h2_mplx *m, struct h2_stream *stream,
156  h2_stream_pri_cmp *cmp, void *ctx);
157 
166 
167 typedef apr_status_t stream_ev_callback(void *ctx, struct h2_stream *stream);
168 
174 
182  void *ctx);
183 
185 
186 typedef int h2_mplx_stream_cb(struct h2_stream *s, void *ctx);
187 
189 
190 apr_status_t h2_mplx_m_client_rst(h2_mplx *m, int stream_id);
191 
198 
199 /*******************************************************************************
200  * From a secondary connection processing: h2_mplx_s_*
201  ******************************************************************************/
202 apr_status_t h2_mplx_s_pop_task(h2_mplx *m, struct h2_task **ptask);
203 void h2_mplx_s_task_done(h2_mplx *m, struct h2_task *task, struct h2_task **ptask);
204 
205 /*******************************************************************************
206  * From a h2_task owner: h2_mplx_s_*
207  * (a task is transfered from master to secondary connection and back in
208  * its normal lifetime).
209  ******************************************************************************/
210 
214 apr_status_t h2_mplx_t_out_open(h2_mplx *mplx, int stream_id,
215  struct h2_bucket_beam *beam);
216 
220 struct h2_stream *h2_mplx_t_stream_get(h2_mplx *m, struct h2_task *task);
221 
222 
223 #endif /* defined(__mod_h2__h2_mplx__) */
struct apr_thread_cond_t * join_wait
Definition: h2_mplx.h:88
size_t apr_size_t
Definition: apr.h:393
struct h2_ihash_t * spurge
Definition: h2_mplx.h:69
apr_time_t last_mood_change
Definition: h2_mplx.h:82
apr_status_t stream_ev_callback(void *ctx, struct h2_stream *stream)
Definition: h2_mplx.h:167
int h2_mplx_m_shutdown(h2_mplx *m)
apr_status_t h2_mplx_m_stream_do(h2_mplx *m, h2_mplx_stream_cb *cb, void *ctx)
Definition: h2_task.h:52
Definition: h2_mplx.h:57
Definition: apr_arch_thread_mutex.h:28
Definition: apr_tables.h:62
server_rec * s
Definition: h2_workers.h:37
apr_pool_t * spare_io_pool
Definition: h2_mplx.h:92
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:555
apr_size_t stream_max_mem
Definition: h2_mplx.h:90
int max_stream_started
Definition: h2_mplx.h:77
unsigned int aborted
Definition: h2_mplx.h:64
Definition: h2.h:133
Thread Safe FIFO bounded queue.
struct h2_stream * h2_mplx_t_stream_get(h2_mplx *m, struct h2_task *task)
apr_status_t h2_mplx_m_client_rst(h2_mplx *m, int stream_id)
Definition: h2_bucket_beam.h:163
struct h2_ififo h2_ififo
Definition: h2_util.h:266
apr_status_t h2_mplx_m_stream_cleanup(h2_mplx *m, struct h2_stream *stream)
apr_status_t h2_mplx_m_reprioritize(h2_mplx *m, h2_stream_pri_cmp *cmp, void *ctx)
apr_status_t h2_mplx_m_child_init(apr_pool_t *pool, server_rec *s)
apr_status_t h2_mplx_t_out_open(h2_mplx *mplx, int stream_id, struct h2_bucket_beam *beam)
apr_int64_t apr_interval_time_t
Definition: apr_time.h:55
apr_status_t h2_mplx_m_process(h2_mplx *m, struct h2_stream *stream, h2_stream_pri_cmp *cmp, void *ctx)
struct h2_workers * workers
Definition: h2_mplx.h:95
apr_thread_mutex_t * lock
Definition: h2_mplx.h:86
Structure to store things which are per connection.
Definition: httpd.h:1183
struct h2_ihash_t * shold
Definition: h2_mplx.h:68
void h2_mplx_m_release_and_join(h2_mplx *m, struct apr_thread_cond_t *wait)
void h2_mplx_s_task_done(h2_mplx *m, struct h2_task *task, struct h2_task **ptask)
struct h2_task * task
Definition: h2_stream.h:96
apr_int64_t apr_time_t
Definition: apr_time.h:45
apr_pool_t * pool
Definition: h2_mplx.h:60
unsigned int is_registered
Definition: h2_mplx.h:65
A structure to store information for each virtual server.
Definition: httpd.h:1370
apr_status_t h2_mplx_m_dispatch_master_events(h2_mplx *m, stream_ev_callback *on_resume, void *ctx)
apr_status_t h2_mplx_s_pop_task(h2_mplx *m, struct h2_task **ptask)
int tasks_active
Definition: h2_mplx.h:78
apr_status_t h2_mplx_m_idle(h2_mplx *m)
int max_active
Definition: h2_mplx.h:80
struct h2_ihash_t h2_ihash_t
Definition: h2_util.h:42
Definition: h2_stream.h:65
struct apr_thread_cond_t * added_output
Definition: h2_mplx.h:87
int limit_active
Definition: h2_mplx.h:79
unsigned int event_pending
Definition: h2_mplx.h:63
apr_interval_time_t mood_update_interval
Definition: h2_mplx.h:83
int h2_stream_pri_cmp(int stream_id1, int stream_id2, void *ctx)
Definition: h2.h:168
struct h2_iqueue * q
Definition: h2_mplx.h:71
struct h2_ihash_t * redo_tasks
Definition: h2_mplx.h:74
struct h2_ihash_t * streams
Definition: h2_mplx.h:67
apr_status_t h2_mplx_m_keep_active(h2_mplx *m, struct h2_stream *stream)
conn_rec * c
Definition: h2_mplx.h:59
long id
Definition: h2_mplx.h:58
struct h2_ififo * readyq
Definition: h2_mplx.h:72
Definition: h2_util.h:76
apr_array_header_t * spare_secondary
Definition: h2_mplx.h:93
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
int h2_mplx_m_has_master_events(h2_mplx *m)
int h2_mplx_stream_cb(struct h2_stream *s, void *ctx)
Definition: h2_mplx.h:186
int irritations_since
Definition: h2_mplx.h:84
int max_streams
Definition: h2_mplx.h:76
Definition: apr_arch_thread_cond.h:34
apr_status_t h2_mplx_m_out_trywait(h2_mplx *m, apr_interval_time_t timeout, struct apr_thread_cond_t *iowait)
Definition: h2_workers.h:36
int h2_mplx_m_awaits_data(h2_mplx *m)
h2_mplx * h2_mplx_m_create(conn_rec *c, server_rec *s, apr_pool_t *master, struct h2_workers *workers)
server_rec * s
Definition: h2_mplx.h:61