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
aeaf64b4
Commit
aeaf64b4
authored
Jan 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Listen: pass EventLoop to listen_global_init()
Don't use global variables.
parent
a137f817
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
Listen.cxx
src/Listen.cxx
+4
-6
Listen.hxx
src/Listen.hxx
+2
-1
Main.cxx
src/Main.cxx
+1
-1
No files found.
src/Listen.cxx
View file @
aeaf64b4
...
...
@@ -44,12 +44,12 @@ static constexpr Domain listen_domain("listen");
class
ClientListener
final
:
public
ServerSocket
{
public
:
ClientListener
(
)
:
ServerSocket
(
*
main
_loop
)
{}
ClientListener
(
EventLoop
&
_loop
)
:
ServerSocket
(
_loop
)
{}
private
:
virtual
void
OnAccept
(
int
fd
,
const
sockaddr
&
address
,
size_t
address_length
,
int
uid
)
{
client_new
(
*
main_loop
,
*
instance
->
partition
,
client_new
(
GetEventLoop
()
,
*
instance
->
partition
,
fd
,
&
address
,
address_length
,
uid
);
}
};
...
...
@@ -101,16 +101,14 @@ listen_systemd_activation(Error &error_r)
}
bool
listen_global_init
(
Error
&
error
)
listen_global_init
(
E
ventLoop
&
loop
,
E
rror
&
error
)
{
assert
(
main_loop
!=
nullptr
);
int
port
=
config_get_positive
(
CONF_PORT
,
DEFAULT_PORT
);
const
struct
config_param
*
param
=
config_get_next_param
(
CONF_BIND_TO_ADDRESS
,
nullptr
);
bool
success
;
listen_socket
=
new
ClientListener
();
listen_socket
=
new
ClientListener
(
loop
);
if
(
listen_systemd_activation
(
error
))
return
true
;
...
...
src/Listen.hxx
View file @
aeaf64b4
...
...
@@ -20,12 +20,13 @@
#ifndef MPD_LISTEN_HXX
#define MPD_LISTEN_HXX
class
EventLoop
;
class
Error
;
extern
int
listen_port
;
bool
listen_global_init
(
Error
&
error
);
listen_global_init
(
E
ventLoop
&
loop
,
E
rror
&
error
);
void
listen_global_finish
(
void
);
...
...
src/Main.cxx
View file @
aeaf64b4
...
...
@@ -413,7 +413,7 @@ int mpd_main(int argc, char *argv[])
const
unsigned
max_clients
=
config_get_positive
(
CONF_MAX_CONN
,
10
);
instance
->
client_list
=
new
ClientList
(
max_clients
);
if
(
!
listen_global_init
(
error
))
{
if
(
!
listen_global_init
(
*
main_loop
,
error
))
{
LogError
(
error
);
return
EXIT_FAILURE
;
}
...
...
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