diff options
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
-rw-r--r-- | src/network/socket/qabstractsocket.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 5a1ad40b90..f9fe40955a 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -549,7 +549,6 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() emittedReadyRead(false), emittedBytesWritten(false), abortCalled(false), - closeCalled(false), pendingClose(false), pauseMode(QAbstractSocket::PauseNever), port(0), @@ -1610,7 +1609,6 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port, d->buffer.clear(); d->writeBuffer.clear(); d->abortCalled = false; - d->closeCalled = false; d->pendingClose = false; d->localPort = 0; d->peerPort = 0; @@ -2650,10 +2648,8 @@ void QAbstractSocket::close() qDebug("QAbstractSocket::close()"); #endif QIODevice::close(); - if (d->state != UnconnectedState) { - d->closeCalled = true; + if (d->state != UnconnectedState) disconnectFromHost(); - } d->localPort = 0; d->peerPort = 0; @@ -2763,19 +2759,12 @@ void QAbstractSocket::disconnectFromHost() d->peerPort = 0; d->localAddress.clear(); d->peerAddress.clear(); + d->writeBuffer.clear(); #if defined(QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocket::disconnectFromHost() disconnected!"); #endif - if (d->closeCalled) { -#if defined(QABSTRACTSOCKET_DEBUG) - qDebug("QAbstractSocket::disconnectFromHost() closed!"); -#endif - d->buffer.clear(); - d->writeBuffer.clear(); - QIODevice::close(); - } } /*! @@ -2926,6 +2915,8 @@ QNetworkProxy QAbstractSocket::proxy() const #ifndef QT_NO_DEBUG_STREAM Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketError error) { + QDebugStateSaver saver(debug); + debug.resetFormat().nospace(); switch (error) { case QAbstractSocket::ConnectionRefusedError: debug << "QAbstractSocket::ConnectionRefusedError"; @@ -2993,6 +2984,8 @@ Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketError er Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, QAbstractSocket::SocketState state) { + QDebugStateSaver saver(debug); + debug.resetFormat().nospace(); switch (state) { case QAbstractSocket::UnconnectedState: debug << "QAbstractSocket::UnconnectedState"; |