Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
0a2f2fda
Commit
0a2f2fda
authored
Aug 13, 2015
by
Marko Mikulicic
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #563 from cesanta/sdp
Tweak event handler a bit for clarity
parents
a73fce94
6b440918
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
server_data_push.c
examples/server_data_push/server_data_push.c
+5
-2
No files found.
examples/server_data_push/server_data_push.c
View file @
0a2f2fda
...
...
@@ -53,6 +53,10 @@ void maybe_send_data(struct mg_connection *conn) {
static
int
ev_handler
(
struct
mg_connection
*
conn
,
enum
mg_event
ev
)
{
switch
(
ev
)
{
case
MG_AUTH
:
return
MG_TRUE
;
/* Authenticated. */
case
MG_WS_HANDSHAKE
:
return
MG_FALSE
;
/* Let Mongoose complete the handshake. */
case
MG_WS_CONNECT
:
fprintf
(
stderr
,
"%s:%u joined
\n
"
,
conn
->
remote_ip
,
conn
->
remote_port
);
conn
->
connection_param
=
calloc
(
1
,
sizeof
(
struct
conn_state
));
...
...
@@ -67,8 +71,6 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
free
(
conn
->
connection_param
);
conn
->
connection_param
=
NULL
;
return
MG_TRUE
;
case
MG_AUTH
:
return
MG_TRUE
;
/* Authenticated. */
default:
return
MG_FALSE
;
}
...
...
@@ -83,6 +85,7 @@ int main(void) {
err
=
mg_set_option
(
server
,
"listening_port"
,
listen_port
);
if
(
err
!=
NULL
)
{
fprintf
(
stderr
,
"Error setting up listener on %s: %s
\n
"
,
listen_port
,
err
);
return
1
;
}
mg_start_thread
(
data_producer
,
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment