module-netjack2: handle driver reconnect

Let the driver keep announcing.
Keep track of when a message was received in the driver. If we don't
receive anything for a while, reconnect.

Don't connect twide in the manager.
This commit is contained in:
Wim Taymans 2023-06-05 13:30:16 +02:00
parent 8db98b114d
commit 04e17a8b1c
2 changed files with 77 additions and 45 deletions

View file

@ -263,7 +263,11 @@ static void reset_volume(struct volume *vol, uint32_t n_volumes)
static void stream_destroy(void *d)
{
struct stream *s = d;
uint32_t i;
spa_hook_remove(&s->listener);
for (i = 0; i < s->n_ports; i++)
s->ports[i] = NULL;
s->filter = NULL;
}
@ -941,9 +945,6 @@ static int handle_follower_available(struct impl *impl, struct nj2_session_param
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize)) < 0)
pw_log_warn("setsockopt(SO_SNDBUF) failed: %m");
if (connect(fd, (struct sockaddr*)addr, addr_len) < 0)
goto connect_error;
impl->follower_id++;
nj2_session_params_hton(params, &peer->params);
@ -962,10 +963,6 @@ socket_failed:
res = fd;
pw_log_error("can't create socket: %s", spa_strerror(res));
goto cleanup;
connect_error:
res = -errno;
pw_log_error("connect() failed: %m");
goto cleanup;
cleanup:
follower_free(follower);
return res;