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
a312629a
Commit
a312629a
authored
Feb 24, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zeroconf: pass global port to init function
parent
d527d4b5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
13 deletions
+9
-13
ZeroconfAvahi.cxx
src/zeroconf/ZeroconfAvahi.cxx
+2
-3
ZeroconfAvahi.hxx
src/zeroconf/ZeroconfAvahi.hxx
+1
-1
ZeroconfBonjour.cxx
src/zeroconf/ZeroconfBonjour.cxx
+2
-3
ZeroconfBonjour.hxx
src/zeroconf/ZeroconfBonjour.hxx
+1
-1
ZeroconfGlue.cxx
src/zeroconf/ZeroconfGlue.cxx
+2
-2
run_avahi.cxx
test/run_avahi.cxx
+1
-3
No files found.
src/zeroconf/ZeroconfAvahi.cxx
View file @
a312629a
...
...
@@ -24,7 +24,6 @@
#include "avahi/Publisher.hxx"
#include "avahi/Service.hxx"
#include "ZeroconfInternal.hxx"
#include "Listen.hxx"
#include "util/Domain.hxx"
#include "util/RuntimeError.hxx"
#include "Log.hxx"
...
...
@@ -55,7 +54,7 @@ public:
static
AvahiGlue
*
avahi_glue
;
void
AvahiInit
(
EventLoop
&
loop
,
const
char
*
serviceName
)
AvahiInit
(
EventLoop
&
loop
,
const
char
*
serviceName
,
unsigned
port
)
{
LogDebug
(
avahi_domain
,
"Initializing interface"
);
...
...
@@ -65,7 +64,7 @@ AvahiInit(EventLoop &loop, const char *serviceName)
std
::
forward_list
<
Avahi
::
Service
>
services
;
services
.
emplace_front
(
AVAHI_IF_UNSPEC
,
AVAHI_PROTO_UNSPEC
,
SERVICE_TYPE
,
listen_
port
);
SERVICE_TYPE
,
port
);
avahi_glue
=
new
AvahiGlue
(
loop
,
serviceName
,
std
::
move
(
services
));
}
...
...
src/zeroconf/ZeroconfAvahi.hxx
View file @
a312629a
...
...
@@ -23,7 +23,7 @@
class
EventLoop
;
void
AvahiInit
(
EventLoop
&
loop
,
const
char
*
service_name
);
AvahiInit
(
EventLoop
&
loop
,
const
char
*
service_name
,
unsigned
port
);
void
AvahiDeinit
();
...
...
src/zeroconf/ZeroconfBonjour.cxx
View file @
a312629a
...
...
@@ -19,7 +19,6 @@
#include "ZeroconfBonjour.hxx"
#include "ZeroconfInternal.hxx"
#include "Listen.hxx"
#include "event/SocketEvent.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
...
...
@@ -84,13 +83,13 @@ dnsRegisterCallback([[maybe_unused]] DNSServiceRef sdRef,
}
void
BonjourInit
(
EventLoop
&
loop
,
const
char
*
service_name
)
BonjourInit
(
EventLoop
&
loop
,
const
char
*
service_name
,
unsigned
port
)
{
DNSServiceRef
dnsReference
;
DNSServiceErrorType
error
=
DNSServiceRegister
(
&
dnsReference
,
0
,
0
,
service_name
,
SERVICE_TYPE
,
nullptr
,
nullptr
,
htons
(
listen_
port
),
0
,
htons
(
port
),
0
,
nullptr
,
dnsRegisterCallback
,
nullptr
);
...
...
src/zeroconf/ZeroconfBonjour.hxx
View file @
a312629a
...
...
@@ -23,7 +23,7 @@
class
EventLoop
;
void
BonjourInit
(
EventLoop
&
loop
,
const
char
*
service_name
);
BonjourInit
(
EventLoop
&
loop
,
const
char
*
service_name
,
unsigned
port
);
void
BonjourDeinit
();
...
...
src/zeroconf/ZeroconfGlue.cxx
View file @
a312629a
...
...
@@ -82,11 +82,11 @@ ZeroconfInit(const ConfigData &config, [[maybe_unused]] EventLoop &loop)
}
#ifdef HAVE_AVAHI
AvahiInit
(
loop
,
serviceName
);
AvahiInit
(
loop
,
serviceName
,
listen_port
);
#endif
#ifdef HAVE_BONJOUR
BonjourInit
(
loop
,
serviceName
);
BonjourInit
(
loop
,
serviceName
,
listen_port
);
#endif
}
...
...
test/run_avahi.cxx
View file @
a312629a
...
...
@@ -23,15 +23,13 @@
#include <stdlib.h>
unsigned
listen_port
=
1234
;
int
main
([[
maybe_unused
]]
int
argc
,
[[
maybe_unused
]]
char
**
argv
)
{
EventLoop
event_loop
;
const
ShutdownHandler
shutdown_handler
(
event_loop
);
AvahiInit
(
event_loop
,
"test"
);
AvahiInit
(
event_loop
,
"test"
,
1234
);
event_loop
.
Run
();
...
...
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