diff options
Diffstat (limited to 'src/network/socket/qabstractsocketengine_p.h')
-rw-r--r-- | src/network/socket/qabstractsocketengine_p.h | 58 |
1 files changed, 14 insertions, 44 deletions
diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index 2da29384a0..9ee79cebc1 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -1,42 +1,6 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtNetwork module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QABSTRACTSOCKETENGINE_P_H #define QABSTRACTSOCKETENGINE_P_H @@ -55,8 +19,9 @@ #include <QtNetwork/private/qtnetworkglobal_p.h> #include "QtNetwork/qhostaddress.h" #include "QtNetwork/qabstractsocket.h" -#include "private/qobject_p.h" +#include <QtCore/qdeadlinetimer.h> #include "private/qnetworkdatagram_p.h" +#include "private/qobject_p.h" QT_BEGIN_NAMESPACE @@ -80,6 +45,8 @@ public: #endif }; +static constexpr std::chrono::seconds DefaultTimeout{30}; + class Q_AUTOTEST_EXPORT QAbstractSocketEngine : public QObject { Q_OBJECT @@ -134,7 +101,7 @@ public: virtual bool connectToHostByName(const QString &name, quint16 port) = 0; virtual bool bind(const QHostAddress &address, quint16 port) = 0; virtual bool listen(int backlog) = 0; - virtual int accept() = 0; + virtual qintptr accept() = 0; virtual void close() = 0; virtual qint64 bytesAvailable() const = 0; @@ -164,11 +131,14 @@ public: virtual int option(SocketOption option) const = 0; virtual bool setOption(SocketOption option, int value) = 0; - virtual bool waitForRead(int msecs = 30000, bool *timedOut = nullptr) = 0; - virtual bool waitForWrite(int msecs = 30000, bool *timedOut = nullptr) = 0; + virtual bool waitForRead(QDeadlineTimer deadline = QDeadlineTimer{DefaultTimeout}, + bool *timedOut = nullptr) = 0; + virtual bool waitForWrite(QDeadlineTimer deadline = QDeadlineTimer{DefaultTimeout}, + bool *timedOut = nullptr) = 0; virtual bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, bool checkRead, bool checkWrite, - int msecs = 30000, bool *timedOut = nullptr) = 0; + QDeadlineTimer deadline = QDeadlineTimer{DefaultTimeout}, + bool *timedOut = nullptr) = 0; QAbstractSocket::SocketError error() const; QString errorString() const; |