Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listening on a file socket #44

Open
WhyNotHugo opened this issue May 27, 2022 · 3 comments
Open

Listening on a file socket #44

WhyNotHugo opened this issue May 27, 2022 · 3 comments

Comments

@WhyNotHugo
Copy link
Contributor

I'm trying to use xdg-dbus-proxy with systemd socket based activation.

That is, systemd creates the socket early during startup, but will initialise the proxy only after receiving the first connection to it.

Currently it is possible to specify a file path via PATH:

xdg-dbus-proxy unix:path="$XDG_RUNTIME_DIR/bus" /path/to/where/the/proxy/listens

In order to do socket activation, the proxy would need to listen on a file descriptor:

xdg-dbus-proxy unix:path="$XDG_RUNTIME_DIR/bus" fd:3

Regrettably, passing simply fd:3 creates a file socket named fd:3. Would it be possible to also support listening of file descriptors for this kind of usage?

@rusty-snake
Copy link

Did you try /proc/self/fd/3 (as workaround)?

@WhyNotHugo
Copy link
Contributor Author

Almost. xdp tries to CREATE the file, and that fails. Maybe this could be handled and try to open the provided path. That's good enough for me.

Error is:

May 27 19:03:27 victory env[453446]: Failed to start proxy for unix:path=/run/user/1000/bus: Error binding to address (GUnixSocketAddress): Address already in use

Note: This error is broken! When the downstream path exists, the error prints the path of the upstream path. I should report that in a separate issue, but noticed it before.

@WhyNotHugo
Copy link
Contributor Author

WhyNotHugo commented May 27, 2022

Looking at flatpak_proxy_start in flatpak-proxy.c: it uses g_unix_socket_address_new, which seems to create a new socket... not sure if it's possible to adapt that to:

  • If path exists, open that.
  • Otherwise, create the socket.

I'm not sure if this would be an acceptable solution either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants