Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
524a7f45
Commit
524a7f45
authored
Jul 15, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Listen: simplify code flow in listen_global_init()
parent
56bfff5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
Listen.cxx
src/Listen.cxx
+12
-15
No files found.
src/Listen.cxx
View file @
524a7f45
...
...
@@ -82,27 +82,24 @@ void
listen_global_init
(
ClientListener
&
listener
)
{
int
port
=
config_get_positive
(
ConfigOption
::
PORT
,
DEFAULT_PORT
);
const
auto
*
param
=
config_get_param
(
ConfigOption
::
BIND_TO_ADDRESS
);
#ifdef ENABLE_SYSTEMD_DAEMON
if
(
listen_systemd_activation
(
listener
))
return
;
#endif
if
(
param
!=
nullptr
)
{
/* "bind_to_address" is configured, create listeners
for all values */
do
{
try
{
listen_add_config_param
(
listener
,
port
,
param
);
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to listen on %s (line %i)"
,
param
->
value
.
c_str
(),
param
->
line
));
}
}
while
((
param
=
param
->
next
)
!=
nullptr
);
}
else
{
for
(
const
auto
*
param
=
config_get_param
(
ConfigOption
::
BIND_TO_ADDRESS
);
param
!=
nullptr
;
param
=
param
->
next
)
{
try
{
listen_add_config_param
(
listener
,
port
,
param
);
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to listen on %s (line %i)"
,
param
->
value
.
c_str
(),
param
->
line
));
}
}
if
(
listener
.
IsEmpty
())
{
/* no "bind_to_address" configured, bind the
configured port on all interfaces */
...
...
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