repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cec: don't wait for the full timeout to pass in CCECProcessor::OpenConnection(),...
[deb_libcec.git]
/
src
/
lib
/
CECProcessor.cpp
diff --git
a/src/lib/CECProcessor.cpp
b/src/lib/CECProcessor.cpp
index 2391ca7e411d9b8d32c7fc060e7adef96f1003fa..a4bbcbc8e0b7ed0d6acb30f0190ed6f21b67a5dd 100644
(file)
--- a/
src/lib/CECProcessor.cpp
+++ b/
src/lib/CECProcessor.cpp
@@
-181,16
+181,14
@@
bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint
return bReturn;
}
return bReturn;
}
- uint64_t iNow = GetTimeMs();
- uint64_t iTarget = iTimeoutMs > 0 ? iNow + iTimeoutMs : iNow + CEC_DEFAULT_TRANSMIT_WAIT;
+ CTimeout timeout(iTimeoutMs > 0 ? iTimeoutMs : CEC_DEFAULT_TRANSMIT_WAIT);
/* open a new connection */
unsigned iConnectTry(0);
/* open a new connection */
unsigned iConnectTry(0);
- while (
iNow < iTarget && (bReturn = m_communication->Open(this, iTimeoutMs
)) == false)
+ while (
timeout.TimeLeft() > 0 && (bReturn = m_communication->Open(this, (timeout.TimeLeft() / CEC_CONNECT_TRIES)
)) == false)
{
CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry);
Sleep(500);
{
CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry);
Sleep(500);
- iNow = GetTimeMs();
}
if (bReturn)
}
if (bReturn)