mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
module-rtp: Attempt to reconnect the ptp management socket
This should gracefully recover the cases where the other end of the socket isn't ready yet when we start or terminates and gets restarted.
This commit is contained in:
parent
76a31a47c2
commit
c1e737bbe4
1 changed files with 12 additions and 1 deletions
|
|
@ -548,8 +548,13 @@ error:
|
||||||
|
|
||||||
static bool update_ts_refclk(struct impl *impl)
|
static bool update_ts_refclk(struct impl *impl)
|
||||||
{
|
{
|
||||||
if (!impl->ptp_mgmt_socket || impl->ptp_fd < 0)
|
if (!impl->ptp_mgmt_socket)
|
||||||
return false;
|
return false;
|
||||||
|
if (impl->ptp_fd < 0) {
|
||||||
|
impl->ptp_fd = make_unix_socket(impl->ptp_mgmt_socket);
|
||||||
|
if (impl->ptp_fd < 0)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Read if something is left in the socket
|
// Read if something is left in the socket
|
||||||
int avail;
|
int avail;
|
||||||
|
|
@ -581,6 +586,12 @@ static bool update_ts_refclk(struct impl *impl)
|
||||||
|
|
||||||
if (write(impl->ptp_fd, &req, sizeof(req)) == -1) {
|
if (write(impl->ptp_fd, &req, sizeof(req)) == -1) {
|
||||||
pw_log_warn("Failed to send PTP management request: %m");
|
pw_log_warn("Failed to send PTP management request: %m");
|
||||||
|
if (errno != ENOTCONN)
|
||||||
|
return false;
|
||||||
|
close(impl->ptp_fd);
|
||||||
|
impl->ptp_fd = make_unix_socket(impl->ptp_mgmt_socket);
|
||||||
|
if (impl->ptp_fd > -1)
|
||||||
|
pw_log_info("Reopened PTP management socket");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue