Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-cellframe
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cellframe
python-cellframe
Commits
65326d8a
Commit
65326d8a
authored
4 years ago
by
alexey.stratulat
Browse files
Options
Downloads
Patches
Plain Diff
[+] Added a SIGINT signal handler or by pressing ctrl + c for Linux operating systems.
parent
c029de42
No related branches found
Branches containing commit
No related tags found
1 merge request
!24
Features 3398
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/python-cellframe.h
+6
-0
6 additions, 0 deletions
include/python-cellframe.h
src/python-cellframe.c
+49
-29
49 additions, 29 deletions
src/python-cellframe.c
with
55 additions
and
29 deletions
include/python-cellframe.h
+
6
−
0
View file @
65326d8a
...
...
@@ -59,9 +59,15 @@
#include
"wrapping_dap_chain_gdb.h"
#include
"dap_common.h"
#include
"signal.h"
#include
"dap_server.h"
void
sigfunc
(
int
sig
);
PyObject
*
python_cellframe_init
(
PyObject
*
self
,
PyObject
*
args
);
void
deinit_modules
(
void
);
PyObject
*
python_cellframe_deinit
(
PyObject
*
self
,
PyObject
*
args
);
static
PyMethodDef
CellFramePythonMethods
[]
=
{
...
...
This diff is collapsed.
Click to expand it.
src/python-cellframe.c
+
49
−
29
View file @
65326d8a
...
...
@@ -21,8 +21,17 @@ static bool s_init_cs_dag_pos = false;
static
bool
s_init_chain_net_srv
=
false
;
static
bool
s_init_ks
=
false
;
static
bool
submodules_deint
;
PyObject
*
CellFrame_error
=
NULL
;
void
sigfunc
(
int
sig
){
if
(
sig
==
SIGINT
){
log_it
(
L_NOTICE
,
"Handler Ctrl+C"
);
dap_server_loop_stop
();
deinit_modules
();
}
}
PyObject
*
python_cellframe_init
(
PyObject
*
self
,
PyObject
*
args
){
const
char
*
app_name
;
...
...
@@ -32,6 +41,9 @@ PyObject *python_cellframe_init(PyObject *self, PyObject *args){
const
char
*
JSON_str
;
s_init_ks
=
true
;
submodules_deint
=
false
;
signal
(
SIGINT
,
sigfunc
);
if
(
!
PyArg_ParseTuple
(
args
,
"s"
,
&
JSON_str
)){
PyErr_SetString
(
CellFrame_error
,
"ERROR in function call signature: can't get one String argument"
);
...
...
@@ -460,36 +472,44 @@ PyMODINIT_FUNC PyInit_libCellFrame(void){
return
module
;
}
PyObject
*
python_cellframe_deinit
(
PyObject
*
self
,
PyObject
*
args
){
if
(
s_init_crypto
){
dap_crypto_deinit
();
dap_cert_deinit
();
}
if
(
s_init_chain
){
deinit_chain_py
();
dap_chain_cs_deinit_py
();
}
if
(
s_init_stream
){
dap_stream_deinit
();
}
if
(
s_init_stream_ctl
){
dap_stream_ctl_deinit
();
}
if
(
s_init_http_folder
){
dap_http_folder_deinit
();
}
if
(
s_init_http
){
dap_http_deinit
();
}
if
(
s_init_server_core
){
dap_server_core_deinit
();
}
if
(
s_init_ks
){
dap_enc_ks_deinit
();
void
deinit_modules
(
void
){
if
(
!
submodules_deint
){
log_it
(
L_NOTICE
,
"Start deint submodules"
);
if
(
s_init_crypto
){
dap_crypto_deinit
();
dap_cert_deinit
();
}
if
(
s_init_chain
){
deinit_chain_py
();
dap_chain_cs_deinit_py
();
}
if
(
s_init_stream
){
dap_stream_deinit
();
}
if
(
s_init_stream_ctl
){
dap_stream_ctl_deinit
();
}
if
(
s_init_http_folder
){
dap_http_folder_deinit
();
}
if
(
s_init_http
){
dap_http_deinit
();
}
if
(
s_init_server_core
){
dap_server_core_deinit
();
}
if
(
s_init_ks
){
dap_enc_ks_deinit
();
}
dap_config_close
(
g_config
);
dap_config_deinit
();
dap_common_deinit
();
submodules_deint
=
true
;
}
dap_config_close
(
g_config
);
dap_config_deinit
();
dap_common_deinit
();
}
PyObject
*
python_cellframe_deinit
(
PyObject
*
self
,
PyObject
*
args
){
deinit_modules
();
return
PyLong_FromLong
(
0
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment