mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-24 03:48:32 +02:00
Fix pipe reconnect
This commit is contained in:
parent
187ed109f0
commit
a704fd11d5
2 changed files with 14 additions and 4 deletions
|
@ -27,6 +27,7 @@
|
|||
// standard headers
|
||||
#include <cerrno>
|
||||
#include <memory>
|
||||
#include <system_error>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
@ -59,7 +60,16 @@ void PipeStream::connect()
|
|||
{
|
||||
int fd = open(uri_.path.c_str(), O_RDONLY | O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
throw SnapException("failed to open fifo \"" + uri_.path + "\": " + cpt::to_string(errno));
|
||||
{
|
||||
std::string error = "failed to open fifo \"" + uri_.path + "\": " + cpt::to_string(errno);
|
||||
if (errno == static_cast<int>(std::errc::no_such_file_or_directory))
|
||||
{
|
||||
LOG(ERROR, LOG_TAG) << error << "\n";
|
||||
wait(read_timer_, 200ms, [this] { connect(); });
|
||||
return;
|
||||
}
|
||||
throw SnapException(error);
|
||||
}
|
||||
|
||||
int pipe_size = -1;
|
||||
#if !defined(MACOS) && !defined(FREEBSD)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue