mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: reuse the socket
This commit is contained in:
parent
d44fdabea1
commit
71e3052a33
1 changed files with 5 additions and 1 deletions
|
|
@ -2723,13 +2723,17 @@ error:
|
||||||
static int make_inet_socket(struct impl *impl, uint32_t address, uint16_t port)
|
static int make_inet_socket(struct impl *impl, uint32_t address, uint16_t port)
|
||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
int res, fd;
|
int res, fd, on;
|
||||||
|
|
||||||
if ((fd = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) < 0) {
|
if ((fd = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) < 0) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
on = 1;
|
||||||
|
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void *) &on, sizeof(on)) < 0)
|
||||||
|
pw_log_warn(NAME" %p: setsockopt(): %m", impl);
|
||||||
|
|
||||||
spa_zero(addr);
|
spa_zero(addr);
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
addr.sin_port = htons(port);
|
addr.sin_port = htons(port);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue