Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libwebsockets
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Fork
libwebsockets
Commits
a8f47c98
Commit
a8f47c98
authored
10 years ago
by
Andrew Canaday
Committed by
Andy Green
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added libwebsocket_sigint_cfg for libev builds to provide
runtime configuration of sigint behavior.
parent
89f5eec5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/libev.c
+21
-2
21 additions, 2 deletions
lib/libev.c
lib/libwebsockets.h
+8
-0
8 additions, 0 deletions
lib/libwebsockets.h
lib/private-libwebsockets.h
+2
-0
2 additions, 0 deletions
lib/private-libwebsockets.h
with
31 additions
and
2 deletions
lib/libev.c
+
21
−
2
View file @
a8f47c98
...
@@ -57,6 +57,21 @@ libwebsocket_sigint_cb(struct ev_loop *loop,
...
@@ -57,6 +57,21 @@ libwebsocket_sigint_cb(struct ev_loop *loop,
ev_break
(
loop
,
EVBREAK_ALL
);
ev_break
(
loop
,
EVBREAK_ALL
);
}
}
LWS_VISIBLE
int
libwebsocket_sigint_cfg
(
struct
libwebsocket_context
*
context
,
int
use_ev_sigint
,
lws_ev_signal_cb
*
cb
)
{
context
->
use_ev_sigint
=
use_ev_sigint
;
if
(
cb
)
{
context
->
lws_ev_sigint_cb
=
cb
;
}
else
{
context
->
lws_ev_sigint_cb
=
&
libwebsocket_sigint_cb
;
};
return
0
;
};
LWS_VISIBLE
int
LWS_VISIBLE
int
libwebsocket_initloop
(
libwebsocket_initloop
(
struct
libwebsocket_context
*
context
,
struct
libwebsocket_context
*
context
,
...
@@ -80,8 +95,12 @@ libwebsocket_initloop(
...
@@ -80,8 +95,12 @@ libwebsocket_initloop(
ev_io_init
(
w_accept
,
libwebsocket_accept_cb
,
ev_io_init
(
w_accept
,
libwebsocket_accept_cb
,
context
->
listen_service_fd
,
EV_READ
);
context
->
listen_service_fd
,
EV_READ
);
ev_io_start
(
context
->
io_loop
,
w_accept
);
ev_io_start
(
context
->
io_loop
,
w_accept
);
ev_signal_init
(
w_sigint
,
libwebsocket_sigint_cb
,
SIGINT
);
ev_signal_start
(
context
->
io_loop
,
w_sigint
);
/* Register the signal watcher unless the user has indicated otherwise: */
if
(
context
->
use_ev_sigint
)
{
ev_signal_init
(
w_sigint
,
context
->
lws_ev_sigint_cb
,
SIGINT
);
ev_signal_start
(
context
->
io_loop
,
w_sigint
);
};
backend
=
ev_backend
(
loop
);
backend
=
ev_backend
(
loop
);
switch
(
backend
)
{
switch
(
backend
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/libwebsockets.h
+
8
−
0
View file @
a8f47c98
...
@@ -1143,6 +1143,14 @@ lws_add_http_header_status(struct libwebsocket_context *context,
...
@@ -1143,6 +1143,14 @@ lws_add_http_header_status(struct libwebsocket_context *context,
LWS_EXTERN
int
lws_http_transaction_completed
(
struct
libwebsocket
*
wsi
);
LWS_EXTERN
int
lws_http_transaction_completed
(
struct
libwebsocket
*
wsi
);
#ifdef LWS_USE_LIBEV
#ifdef LWS_USE_LIBEV
typedef
void
(
lws_ev_signal_cb
)(
EV_P_
struct
ev_signal
*
w
,
int
revents
);
LWS_VISIBLE
LWS_EXTERN
int
libwebsocket_sigint_cfg
(
struct
libwebsocket_context
*
context
,
int
use_ev_sigint
,
lws_ev_signal_cb
*
cb
);
LWS_VISIBLE
LWS_EXTERN
int
LWS_VISIBLE
LWS_EXTERN
int
libwebsocket_initloop
(
libwebsocket_initloop
(
struct
libwebsocket_context
*
context
,
struct
ev_loop
*
loop
);
struct
libwebsocket_context
*
context
,
struct
ev_loop
*
loop
);
...
...
This diff is collapsed.
Click to expand it.
lib/private-libwebsockets.h
+
2
−
0
View file @
a8f47c98
...
@@ -438,6 +438,8 @@ struct libwebsocket_context {
...
@@ -438,6 +438,8 @@ struct libwebsocket_context {
struct
ev_loop
*
io_loop
;
struct
ev_loop
*
io_loop
;
struct
lws_io_watcher
w_accept
;
struct
lws_io_watcher
w_accept
;
struct
lws_signal_watcher
w_sigint
;
struct
lws_signal_watcher
w_sigint
;
lws_ev_signal_cb
*
lws_ev_sigint_cb
;
int
use_ev_sigint
;
#endif
/* LWS_USE_LIBEV */
#endif
/* LWS_USE_LIBEV */
int
max_fds
;
int
max_fds
;
int
listen_port
;
int
listen_port
;
...
...
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