mirror of https://git.kore.io/kore.git
Add kore_shutdown().
Allows workers to cleanly initiate a shutdown of the entire server process.
This commit is contained in:
parent
4c35073232
commit
c41c1db303
|
@ -540,6 +540,7 @@ extern struct kore_domain *primary_dom;
|
|||
extern struct kore_pool nb_pool;
|
||||
|
||||
void kore_signal(int);
|
||||
void kore_shutdown(void);
|
||||
void kore_signal_setup(void);
|
||||
void kore_worker_wait(int);
|
||||
void kore_worker_init(void);
|
||||
|
|
|
@ -33,6 +33,7 @@ static PyObject *python_kore_bind(PyObject *, PyObject *);
|
|||
static PyObject *python_kore_fatal(PyObject *, PyObject *);
|
||||
static PyObject *python_kore_queue(PyObject *, PyObject *);
|
||||
static PyObject *python_kore_fatalx(PyObject *, PyObject *);
|
||||
static PyObject *python_kore_shutdown(PyObject *, PyObject *);
|
||||
static PyObject *python_kore_bind_unix(PyObject *, PyObject *);
|
||||
static PyObject *python_kore_task_create(PyObject *, PyObject *);
|
||||
static PyObject *python_kore_socket_wrap(PyObject *, PyObject *);
|
||||
|
@ -55,6 +56,7 @@ static struct PyMethodDef pykore_methods[] = {
|
|||
METHOD("queue", python_kore_queue, METH_VARARGS),
|
||||
METHOD("fatal", python_kore_fatal, METH_VARARGS),
|
||||
METHOD("fatalx", python_kore_fatalx, METH_VARARGS),
|
||||
METHOD("shutdown", python_kore_shutdown, METH_NOARGS),
|
||||
METHOD("bind_unix", python_kore_bind_unix, METH_VARARGS),
|
||||
METHOD("task_create", python_kore_task_create, METH_VARARGS),
|
||||
METHOD("socket_wrap", python_kore_socket_wrap, METH_VARARGS),
|
||||
|
|
11
src/kore.c
11
src/kore.c
|
@ -541,6 +541,17 @@ kore_signal(int sig)
|
|||
sig_recv = sig;
|
||||
}
|
||||
|
||||
void
|
||||
kore_shutdown(void)
|
||||
{
|
||||
if (worker != NULL) {
|
||||
kore_msg_send(KORE_MSG_PARENT, KORE_MSG_SHUTDOWN, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
fatal("kore_shutdown: called from parent");
|
||||
}
|
||||
|
||||
static void
|
||||
kore_server_sslstart(void)
|
||||
{
|
||||
|
|
|
@ -958,6 +958,14 @@ python_kore_fatalx(PyObject *self, PyObject *args)
|
|||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
python_kore_shutdown(PyObject *self, PyObject *args)
|
||||
{
|
||||
kore_shutdown();
|
||||
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
python_import(const char *path)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue