mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pulse-server: add the peer ip to client properties
When clients connect with IP, add the peer IP address to properties. We might use this later to make a better stream node.name than a copy of the client application name.
This commit is contained in:
parent
fdc74df383
commit
468a9ac954
1 changed files with 10 additions and 0 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include <spa/utils/result.h>
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
#include "network-utils.h"
|
||||
#include "client.h"
|
||||
#include "commands.h"
|
||||
#include "defs.h"
|
||||
|
|
@ -375,6 +376,7 @@ on_connect(void *data, int fd, uint32_t mask)
|
|||
struct client *client = NULL;
|
||||
const char *client_access = NULL;
|
||||
const char *error_reason = NULL;
|
||||
char ipname[256];
|
||||
pid_t pid;
|
||||
|
||||
length = sizeof(name);
|
||||
|
|
@ -418,10 +420,18 @@ on_connect(void *data, int fd, uint32_t mask)
|
|||
if (client->props == NULL)
|
||||
goto error;
|
||||
|
||||
|
||||
pw_properties_setf(client->props,
|
||||
"pulse.server.type", "%s",
|
||||
server->addr.ss_family == AF_UNIX ? "unix" : "tcp");
|
||||
|
||||
if (server->addr.ss_family != AF_UNIX) {
|
||||
uint16_t port = 0;
|
||||
if (pw_net_get_ip(&name, ipname, sizeof(ipname), NULL, &port) >= 0)
|
||||
pw_properties_setf(client->props,
|
||||
"pulse.server.peer", "%s:%d", ipname, port);
|
||||
}
|
||||
|
||||
client->routes = pw_properties_new(NULL, NULL);
|
||||
if (client->routes == NULL)
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue