diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-06-06 18:57:58 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-06-06 18:57:58 +0300 |
commit | d0c72e07261ac3ee57573b7f41732fab76862aee (patch) | |
tree | c59663adc63aeef81a1701dc42e70b2e27b20591 /src/nxt_controller.c | |
parent | 49e9049ed2b00f2f3ce5bacd75dbc21932836a25 (diff) | |
download | unit-d0c72e07261ac3ee57573b7f41732fab76862aee.tar.gz unit-d0c72e07261ac3ee57573b7f41732fab76862aee.tar.bz2 |
C99 style declaration of connection states.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_controller.c | 59 |
1 files changed, 21 insertions, 38 deletions
diff --git a/src/nxt_controller.c b/src/nxt_controller.c index 93d0c2c5..c8522573 100644 --- a/src/nxt_controller.c +++ b/src/nxt_controller.c @@ -240,16 +240,13 @@ nxt_controller_conn_init(nxt_task_t *task, void *obj, void *data) static const nxt_event_conn_state_t nxt_controller_conn_read_state nxt_aligned(64) = { - NXT_EVENT_NO_BUF_PROCESS, - NXT_EVENT_TIMER_NO_AUTORESET, + .ready_handler = nxt_controller_conn_read, + .close_handler = nxt_controller_conn_close, + .error_handler = nxt_controller_conn_read_error, - nxt_controller_conn_read, - nxt_controller_conn_close, - nxt_controller_conn_read_error, - - nxt_controller_conn_read_timeout, - nxt_controller_conn_timeout_value, - 60 * 1000, + .timer_handler = nxt_controller_conn_read_timeout, + .timer_value = nxt_controller_conn_timeout_value, + .timer_data = 60 * 1000, }; @@ -365,16 +362,14 @@ nxt_controller_conn_read_timeout(nxt_task_t *task, void *obj, void *data) static const nxt_event_conn_state_t nxt_controller_conn_body_read_state nxt_aligned(64) = { - NXT_EVENT_NO_BUF_PROCESS, - NXT_EVENT_TIMER_AUTORESET, - - nxt_controller_conn_body_read, - nxt_controller_conn_close, - nxt_controller_conn_read_error, - - nxt_controller_conn_read_timeout, - nxt_controller_conn_timeout_value, - 60 * 1000, + .ready_handler = nxt_controller_conn_body_read, + .close_handler = nxt_controller_conn_close, + .error_handler = nxt_controller_conn_read_error, + + .timer_handler = nxt_controller_conn_read_timeout, + .timer_value = nxt_controller_conn_timeout_value, + .timer_data = 60 * 1000, + .timer_autoreset = 1, }; @@ -409,16 +404,13 @@ nxt_controller_conn_body_read(nxt_task_t *task, void *obj, void *data) static const nxt_event_conn_state_t nxt_controller_conn_write_state nxt_aligned(64) = { - NXT_EVENT_NO_BUF_PROCESS, - NXT_EVENT_TIMER_AUTORESET, + .ready_handler = nxt_controller_conn_write, + .error_handler = nxt_controller_conn_write_error, - nxt_controller_conn_write, - NULL, - nxt_controller_conn_write_error, - - nxt_controller_conn_write_timeout, - nxt_controller_conn_timeout_value, - 60 * 1000, + .timer_handler = nxt_controller_conn_write_timeout, + .timer_value = nxt_controller_conn_timeout_value, + .timer_data = 60 * 1000, + .timer_autoreset = 1, }; @@ -479,16 +471,7 @@ nxt_controller_conn_write_timeout(nxt_task_t *task, void *obj, void *data) static const nxt_event_conn_state_t nxt_controller_conn_close_state nxt_aligned(64) = { - NXT_EVENT_NO_BUF_PROCESS, - NXT_EVENT_TIMER_NO_AUTORESET, - - nxt_controller_conn_free, - NULL, - NULL, - - NULL, - NULL, - 0, + .ready_handler = nxt_controller_conn_free, }; |