diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 8 | ||||
-rw-r--r-- | src/network/socket/qlocalserver_unix.cpp | 6 | ||||
-rw-r--r-- | src/network/socket/qlocalsocket_win.cpp | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 980c0e0..5940fba 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -265,6 +265,11 @@ bool QHttpNetworkConnectionPrivate::ensureConnection(QAbstractSocket *socket) if (socket->state() != QAbstractSocket::ConnectedState) { // connect to the host if not already connected. int index = indexOf(socket); + // resend this request after we receive the disconnected signal + if (socket->state() == QAbstractSocket::ClosingState) { + channels[index].resendCurrent = true; + return false; + } channels[index].state = ConnectingState; channels[index].pendingEncrypt = encrypt; @@ -982,6 +987,9 @@ void QHttpNetworkConnectionPrivate::_q_disconnected() channels[i].state = ReadingState; if (channels[i].reply) receiveReply(socket, channels[i].reply); + } else if (channels[i].state == IdleState && channels[i].resendCurrent) { + // re-sending request because the socket was in ClosingState + QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); } channels[i].state = IdleState; } diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 065a9de..e7d2252 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -148,9 +148,11 @@ void QLocalServerPrivate::closeServer() QT_CLOSE(listenSocket); listenSocket = -1; - if (socketNotifier) + if (socketNotifier) { + socketNotifier->setEnabled(false); // Otherwise, closed socket is checked before deleter runs socketNotifier->deleteLater(); - socketNotifier = 0; + socketNotifier = 0; + } if (!fullServerName.isEmpty()) QFile::remove(fullServerName); diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index e759d0b..39c9284 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -298,7 +298,7 @@ qint64 QLocalSocketPrivate::bytesAvailable() if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) { return bytes; } else { - if (ERROR_BROKEN_PIPE == GetLastError() && !pipeClosed) { + if (!pipeClosed) { pipeClosed = true; QTimer::singleShot(0, q, SLOT(_q_pipeClosed())); } |