Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# automake related
.dirstamp

# Compiled Object files
*.slo
*.lo
Expand Down
15 changes: 14 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,22 @@ void Main::loop(const string & device) {
}
commands.pop();
}
int retriesRemaining = 3;
while( running && !libcec_cond.timed_wait(libcec_lock, boost::posix_time::seconds(43)) )
{
running = cec.ping();
// Since libcec's CAdapterPingThread::Process() tries pinging 3 times before raising a
// connection lost alert, lets also make 3 attempts otherwise we'll stop running
// before our alert handling gets a chance to do its job
bool pinged = false;
if( retriesRemaining > 0 && !(pinged = cec.ping()) )
{
--retriesRemaining;
boost::this_thread::sleep(boost::posix_time::milliseconds(CEC_DEFAULT_TRANSMIT_RETRY_WAIT));
}
else
{
running = pinged;
}
}
}
while( running );
Expand Down