summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp10
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp17
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.h2
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp2
-rw-r--r--src/network/socket/qabstractsocket.cpp2
5 files changed, 22 insertions, 11 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 34fd7a7..db57e90 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -860,6 +860,8 @@ void QNetworkReplyImpl::abort()
if (d->state != QNetworkReplyImplPrivate::Finished) {
// call finished which will emit signals
d->error(OperationCanceledError, tr("Operation canceled"));
+ if (d->state == QNetworkReplyImplPrivate::WaitingForSession)
+ d->state = QNetworkReplyImplPrivate::Working;
d->finished();
}
d->state = QNetworkReplyImplPrivate::Aborted;
@@ -1019,10 +1021,6 @@ bool QNetworkReplyImplPrivate::migrateBackend()
if (state == Finished || state == Aborted)
return true;
- // Backend does not support resuming download.
- if (!backend->canResume())
- return false;
-
// Request has outgoing data, not migrating.
if (outgoingData)
return false;
@@ -1031,6 +1029,10 @@ bool QNetworkReplyImplPrivate::migrateBackend()
if (copyDevice)
return true;
+ // Backend does not support resuming download.
+ if (!backend->canResume())
+ return false;
+
state = QNetworkReplyImplPrivate::Reconnecting;
if (backend) {
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index e9b6703..42fc49d 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -385,8 +385,6 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer)));
connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)));
-
- QMetaObject::invokeMethod(engine, "initialize");
}
}
@@ -410,8 +408,19 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
startPolling();
}
- if (firstUpdate)
+ if (firstUpdate) {
firstUpdate = false;
+ QList<QBearerEngine*> enginesToInitialize = sessionEngines; //shallow copy the list in case it is modified when we unlock mutex
+ Qt::ConnectionType connectionType;
+ if (QCoreApplicationPrivate::mainThread() == QThread::currentThread())
+ connectionType = Qt::DirectConnection;
+ else
+ connectionType = Qt::BlockingQueuedConnection;
+ locker.unlock();
+ foreach (QBearerEngine* engine, enginesToInitialize) {
+ QMetaObject::invokeMethod(engine, "initialize", connectionType);
+ }
+ }
}
void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate()
@@ -479,7 +488,7 @@ void QNetworkConfigurationManagerPrivate::enablePolling()
++forcedPolling;
if (forcedPolling == 1)
- startPolling();
+ QMetaObject::invokeMethod(this, "startPolling");
}
void QNetworkConfigurationManagerPrivate::disablePolling()
diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h
index abc4b9b..45d6a75 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.h
+++ b/src/network/bearer/qnetworkconfigmanager_p.h
@@ -107,7 +107,7 @@ private Q_SLOTS:
void pollEngines();
private:
- void startPolling();
+ Q_INVOKABLE void startPolling();
QTimer *pollTimer;
private:
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index 6098bde..7f251a7 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -219,7 +219,7 @@ static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfa
#ifdef SIOCGIFHWADDR
// Get the HW address
if (qt_safe_ioctl(socket, SIOCGIFHWADDR, &req) >= 0) {
- uchar *addr = (uchar *)&req.ifr_addr;
+ uchar *addr = (uchar *)req.ifr_addr.sa_data;
iface->hardwareAddress = iface->makeHwAddress(6, addr);
}
#endif
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index fc0bb85..e5af5c6 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -1908,7 +1908,7 @@ bool QAbstractSocket::waitForReadyRead(int msecs)
if (state() != ConnectedState)
return false;
- } while (qt_timeout_value(msecs, stopWatch.elapsed()) > 0);
+ } while (msecs == -1 || qt_timeout_value(msecs, stopWatch.elapsed()) > 0);
return false;
}