diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-04-29 15:07:14 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-10-24 18:29:45 +0300 |
commit | ceee7acf43464dbbcca7e05911e354532c5435f6 (patch) | |
tree | a366386e504305f72775059fb44fb559ba5bef36 /src/network/socket/qlocalsocket_unix.cpp | |
parent | df2e07549e6edd1d271cce1d86cadd4a33dfd8fc (diff) |
qcore_unix: port qt_safe_poll to QDeadlineTimer
Remove qt_poll_msecs() since the "forever" state can be simply expressed
with a QDeadlineTimer::Forever arg, instead of passing a nullptr
timespec, and the negative timeouts treated as "run forever" is also
encapsulated by QDealineTimer.
Use the QDealineTimer(qint64) constructor in the call sites where
the timeout could be negative, so that it creates a Forever timer (the
QDeadlineTimer(chrono::duration) constructor uses
setRemainingTime(duration) which handles negative timeouts by creating
expired timers).
Remove qt_gettime() (and do_gettime()).
Drive-by changes:
- Fix a narrowing conversion warning, qt_make_pollfd() takes an int
- Remove an unused include
Change-Id: I096319af5e191e28c3d39295fb1aafe9d69841e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/socket/qlocalsocket_unix.cpp')
-rw-r--r-- | src/network/socket/qlocalsocket_unix.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 6e9133ad8f..af0dc988af 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -25,7 +25,6 @@ using namespace std::chrono_literals; #define QT_CONNECT_TIMEOUT 30000 - QT_BEGIN_NAMESPACE using namespace Qt::StringLiterals; @@ -593,9 +592,7 @@ bool QLocalSocket::waitForConnected(int msec) auto remainingTime = deadline.remainingTimeAsDuration(); do { - timespec ts = durationToTimespec(remainingTime); - const int result = qt_safe_poll(&pfd, 1, &ts); - + const int result = qt_safe_poll(&pfd, 1, deadline); if (result == -1) d->setErrorAndEmit(QLocalSocket::UnknownSocketError, "QLocalSocket::waitForConnected"_L1); |