Re: [mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-03 Thread Punky
Thanks Max,

Thus, MPD currently does not enable zeroconf when socket activation is
> used, because MPD does not know what port to announce.
>

I understand this now.


> systemd would activate the socket on behalf of the service because you
> told it to.  It is optional, and you enabled it ("systemctl enable
> mpd.socket" instead of "systemctl enable mpd.service").
>

So to make zeroconf works under systemd, I need to "systemctl disable
mpd.socket" then "systemctl enable mpd.service" and "systemctl restart
mpd.service".  Zeroconf works again.

-- 
-- 

Regards,
Kim-man "Punky" Tse

* Open Source Embedded Solutions and Systems
  - Voyage Linux (http://linux.voyage.hk)
  - Voyage MPD   (http://linux.voyage.hk/voyage-mpd)
  - Voyage MuBox (http://mubox.voyage.hk)
* Voyage Store   (http://store.voyage.hk)
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel


Re: [mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-03 Thread Ben Boeckel
On Wed, Dec 03, 2014 at 20:25:55 +0100, Max Kellermann wrote:
> But combining socket activation with zeroconf would be a rather
> pointless exercise.  You would only be able to find MPD after you
> already connected to MPD.

Ah, indeed, that is a chicken-and-egg. I guess documentation would be
the best fix here then.

--Ben
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel


Re: [mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-03 Thread Max Kellermann
On 2014/12/03 16:49, Ben Boeckel  wrote:
> On Wed, Dec 03, 2014 at 08:17:39 +0100, Max Kellermann wrote:
> > Thus, MPD currently does not enable zeroconf when socket activation is
> > used, because MPD does not know what port to announce.
> 
> Would getsockname(2) help?

Yes, that could be used to find out, under certain circumstances.

But combining socket activation with zeroconf would be a rather
pointless exercise.  You would only be able to find MPD after you
already connected to MPD.
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel


Re: [mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-03 Thread Ben Boeckel
On Wed, Dec 03, 2014 at 08:17:39 +0100, Max Kellermann wrote:
> Thus, MPD currently does not enable zeroconf when socket activation is
> used, because MPD does not know what port to announce.

Would getsockname(2) help?

--Ben
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel


Re: [mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-02 Thread Max Kellermann
On 2014/12/03 02:56, Punky  wrote:
> In zeroconf module, listen_port variable is used.  listen_port variable
> should be set to the value that MPD (successfully) listens to, and if TCP
> port (default 6600) is being configured

But listen_port is ignored when systemd socket activation is used.
With socket activation, listen_port may or may not describe the port
that systemd listens to - there is no relation between the two.

Thus, MPD currently does not enable zeroconf when socket activation is
used, because MPD does not know what port to announce.

> I don't know much about systemd, and don't understand why systemd would
> active the socket on behalf of the service (similar to inetd or
> xinetd!?).

systemd would activate the socket on behalf of the service because you
told it to.  It is optional, and you enabled it ("systemctl enable
mpd.socket" instead of "systemctl enable mpd.service").
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel


Re: [mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-02 Thread Punky
Hi Max and all,

On Wed, Dec 3, 2014 at 4:39 AM, Max Kellermann  wrote:

>
> > listen_systemd_activation() is true.  Then the function exit
> > immediately without setting listen_port = port.
>
> Correct.  Which value do you expect it to have, and where will it
> obtain that value from?
>

In zeroconf module, listen_port variable is used.  listen_port variable
should be set to the value that MPD (successfully) listens to, and if TCP
port (default 6600) is being configured

I don't know much about systemd, and don't understand why systemd would
active the socket on behalf of the service (similar to inetd or xinetd!?).
But it seems to me listen_port is no longer set when systemd is enabled.

The problem here is when listen_port does not set, zeroconf is not enable.
I read through the codes on zeroconf module that it publishes the service
port using listen_port.

To make zeroconf works with systemd again, the argument is:

1. Just a added "listen_port=port;" after the test of
listen_systemd_activation()
is true? or
2. change zeroconf module to use port variable to publish the service? (but
port being configured does not mean mpd successfully listens to it)

It didn't read many mpd codes, so I don't understand the impact after any
of the above changes.  I am happy to discuss and find a right solution.


-- 
-- 

Regards,
Kim-man "Punky" Tse

* Open Source Embedded Solutions and Systems
  - Voyage Linux (http://linux.voyage.hk)
  - Voyage MPD   (http://linux.voyage.hk/voyage-mpd)
  - Voyage MuBox (http://mubox.voyage.hk)
* Voyage Store   (http://store.voyage.hk)
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel


Re: [mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-02 Thread Max Kellermann
On 2014/12/02 08:13, Punky  wrote:
> Since jessie now uses systemd instead of sysvinit,

But does it enable socket activation by default?

> listen_systemd_activation() is true.  Then the function exit
> immediately without setting listen_port = port.

Correct.  Which value do you expect it to have, and where will it
obtain that value from?
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel


[mpd-devel] systemd and "zeroconf: No global port, disabling zeroconf"

2014-12-01 Thread Punky
Hi all,

I am now trying Debian jessie with 0.19.1.  However, zeroconf is not
enabled, and /var/log/mpd/mpd.log shows "zeroconf: No global port,
disabling zeroconf".

Further looking into the code, I found the following in
zeroconf/ZeroconfGlue.cxx, line 52-57:

if (listen_port <= 0) {
LogWarning(zeroconf_domain,
   "No global port, disabling zeroconf");
zeroconfEnabled = false;
return;
}

then in Listen.cxx, line 112-118

#ifdef ENABLE_SYSTEMD_DAEMON
if (listen_systemd_activation(error))
return true;

if (error.IsDefined())
return false;
#endif

//...line 149-151:
listen_port = port;
return true;
}

Since jessie now uses systemd instead of sysvinit,
listen_systemd_activation() is true.  Then the function exit immediately
without setting listen_port = port.

Correct me if I am wrong as I just guess from reading the code.

-- 
-- 

Regards,
Kim-man "Punky" Tse

* Open Source Embedded Solutions and Systems
  - Voyage Linux (http://linux.voyage.hk)
  - Voyage MPD   (http://linux.voyage.hk/voyage-mpd)
  - Voyage MuBox (http://mubox.voyage.hk)
* Voyage Store   (http://store.voyage.hk)
___
mpd-devel mailing list
mpd-devel@musicpd.org
http://mailman.blarg.de/listinfo/mpd-devel