Reformat code

This commit is contained in:
badaix 2020-05-31 13:46:26 +02:00
parent c07b56816d
commit c1c521b260
2 changed files with 4 additions and 13 deletions

View file

@ -232,25 +232,17 @@ void AirplayStream::pipeReadLine()
boost::asio::async_read_until(*pipe_fd_, streambuf_pipe_, delimiter, [this, delimiter](const std::error_code& ec, std::size_t bytes_transferred) {
if (ec)
{
if (ec.value() == boost::asio::error::eof)
if ((ec.value() == boost::asio::error::eof) || (ec.value() == boost::asio::error::bad_descriptor))
{
// For some reason, EOF is returned until the first metadata is written to the pipe.
// Is this a boost bug?
// If shairport-sync has not finished setting up the pipe, bad file descriptor is returned.
LOG(INFO, LOG_TAG) << "Waiting for metadata, retrying in 2500ms"
<< "\n";
wait(pipe_open_timer_, 2500ms, [this] { pipeReadLine(); });
}
if (ec.value() == boost::asio::error::bad_descriptor)
{
// If shairport-sync has not finished setting up the pipe, bad file descriptor is returned.
// retry in a few seconds
LOG(INFO, LOG_TAG) << "Waiting for metadata, retrying in 2500ms"
<< "\n";
wait(pipe_open_timer_, 2500ms, [this] { pipeReadLine(); });
}
else
{
LOG(ERROR, LOG_TAG) << "Error while reading from metadata pipe: " << ec.message() << "\n";
LOG(ERROR, LOG_TAG) << "Error while reading from metadata pipe: " << ec.message() << "\n";
}
return;
}