11# cython: language_level=3
22
33import traceback
4+ from enum import IntEnum
45
56from .nginx_config cimport ngx_int_t
6- from .nginx_core cimport ngx_cycle_t
7- from .nginx_core cimport NGX_OK, NGX_ERROR
7+ from .nginx_core cimport ngx_module_t, ngx_cycle_t
8+ from .nginx_core cimport NGX_OK, NGX_ERROR, NGX_DECLINED, NGX_AGAIN
89from .nginx_core cimport NGX_LOG_DEBUG, NGX_LOG_CRIT
910from .nginx_core cimport ngx_log_error
1011
11- from . import hooks
12+
13+ cdef extern from " ngx_python_module.h" :
14+ ngx_module_t ngx_python_module
15+
16+
17+ class ReturnCode (IntEnum ):
18+ ok = NGX_OK
19+ error = NGX_ERROR
20+ declined = NGX_DECLINED
21+ again = NGX_AGAIN
1222
1323
1424cdef public ngx_int_t nginxpy_init_process(ngx_cycle_t * cycle):
1525 ngx_log_error(NGX_LOG_DEBUG, cycle.log, 0 ,
1626 b' Starting init_process.' )
1727 # noinspection PyBroadException
1828 try :
29+ from . import hooks
1930 global current_cycle
2031 current_cycle = Cycle.from_ptr(cycle)
2132 set_last_resort(current_cycle.log)
@@ -36,6 +47,7 @@ cdef public void nginxpy_exit_process(ngx_cycle_t *cycle):
3647 b' Starting exit_process.' )
3748 # noinspection PyBroadException
3849 try :
50+ from . import hooks
3951 global current_cycle
4052 hooks.exit_process()
4153 unset_last_resort()
@@ -49,10 +61,7 @@ cdef public void nginxpy_exit_process(ngx_cycle_t *cycle):
4961 b' Finished exit_process.' )
5062
5163
52- cdef public void nginxpy_post_read():
53- hooks.post_read()
54-
55-
5664include " log.pyx"
5765include " cycle.pyx"
66+ include " http/http.pyx"
5867include " asyncio/loop.pyx"
0 commit comments