Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
mongoose
Commits
2cce91de
Commit
2cce91de
authored
Oct 14, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored code for multiple listeners
parent
0ff5b5b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
mongoose.c
mongoose.c
+12
-18
No files found.
mongoose.c
View file @
2cce91de
...
@@ -4946,22 +4946,6 @@ static void set_default_option_values(char **opts) {
...
@@ -4946,22 +4946,6 @@ static void set_default_option_values(char **opts) {
}
}
}
}
static
const
char
*
add_listener
(
struct
mg_server
*
server
,
char
**
v
,
const
char
*
value
)
{
const
char
*
error_msg
=
NULL
;
struct
ns_connection
*
c
;
if
((
c
=
ns_bind
(
&
server
->
ns_mgr
,
value
,
mg_ev_handler
,
NULL
))
==
NULL
)
{
error_msg
=
"Cannot bind to port"
;
}
else
{
char
buf
[
100
];
ns_sock_to_str
(
c
->
sock
,
buf
,
sizeof
(
buf
),
2
);
free
(
*
v
);
*
v
=
mg_strdup
(
buf
);
}
return
error_msg
;
}
const
char
*
mg_set_option
(
struct
mg_server
*
server
,
const
char
*
name
,
const
char
*
mg_set_option
(
struct
mg_server
*
server
,
const
char
*
name
,
const
char
*
value
)
{
const
char
*
value
)
{
int
ind
=
get_option_index
(
name
);
int
ind
=
get_option_index
(
name
);
...
@@ -4989,8 +4973,18 @@ const char *mg_set_option(struct mg_server *server, const char *name,
...
@@ -4989,8 +4973,18 @@ const char *mg_set_option(struct mg_server *server, const char *name,
if
(
ind
==
LISTENING_PORT
)
{
if
(
ind
==
LISTENING_PORT
)
{
struct
vec
vec
;
struct
vec
vec
;
while
(
!
error_msg
&&
(
value
=
next_option
(
value
,
&
vec
,
NULL
))
!=
NULL
)
{
while
((
value
=
next_option
(
value
,
&
vec
,
NULL
))
!=
NULL
)
{
error_msg
=
add_listener
(
server
,
v
,
vec
.
ptr
);
struct
ns_connection
*
c
=
ns_bind
(
&
server
->
ns_mgr
,
vec
.
ptr
,
mg_ev_handler
,
NULL
);
if
(
c
==
NULL
)
{
error_msg
=
"Cannot bind to port"
;
break
;
}
else
{
char
buf
[
100
];
ns_sock_to_str
(
c
->
sock
,
buf
,
sizeof
(
buf
),
2
);
free
(
*
v
);
*
v
=
mg_strdup
(
buf
);
}
}
}
#ifndef MONGOOSE_NO_FILESYSTEM
#ifndef MONGOOSE_NO_FILESYSTEM
}
else
if
(
ind
==
HEXDUMP_FILE
)
{
}
else
if
(
ind
==
HEXDUMP_FILE
)
{
...
...
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