summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-03-18 11:21:08 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-03-18 11:57:27 (GMT)
commitb35009bab4d4353aa82830f4f7f8c29700b2bd08 (patch)
treec8afae93613c63195644f1cfcb84b7f03c93fd80
parent690ca356c52f0e4f83f5b6cb4b54fdc6db2af5ba (diff)
downloadQt-b35009bab4d4353aa82830f4f7f8c29700b2bd08.zip
Qt-b35009bab4d4353aa82830f4f7f8c29700b2bd08.tar.gz
Qt-b35009bab4d4353aa82830f4f7f8c29700b2bd08.tar.bz2
Fix "wrong lookup id" warning from QAbstractSocket
Symbian host info implementation was using default constructor for the results, which sets the id to -1, and storing the id seperately. Changed this to use the constructor that specifies the id, and use the id inside the results instead of storing it separately (just a change to the accessor function) Reviewed-by: Markus Goetz
-rw-r--r--src/network/kernel/qhostinfo_p.h2
-rw-r--r--src/network/kernel/qhostinfo_symbian.cpp28
2 files changed, 23 insertions, 7 deletions
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index 72175f0..79fad84 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -243,8 +243,6 @@ private:
void processAddressResults();
private:
- int iId;
-
const QString iHostName;
RSocketServ& iSocketServ;
diff --git a/src/network/kernel/qhostinfo_symbian.cpp b/src/network/kernel/qhostinfo_symbian.cpp
index 2b582bd..ad5f38a 100644
--- a/src/network/kernel/qhostinfo_symbian.cpp
+++ b/src/network/kernel/qhostinfo_symbian.cpp
@@ -217,14 +217,17 @@ QString QHostInfo::localDomainName()
QSymbianHostResolver::QSymbianHostResolver(const QString &hostName, int identifier)
- : CActive(CActive::EPriorityStandard), iId(identifier), iHostName(hostName),
- iSocketServ(qt_symbianGetSocketServer())
+ : CActive(CActive::EPriorityStandard), iHostName(hostName),
+ iSocketServ(qt_symbianGetSocketServer()), iResults(identifier)
{
CActiveScheduler::Add(this);
}
QSymbianHostResolver::~QSymbianHostResolver()
{
+#if defined(QHOSTINFO_DEBUG)
+ qDebug() << "QSymbianHostInfoLookupManger::~QSymbianHostResolver" << id();
+#endif
Cancel();
iHostResolver.Close();
}
@@ -234,8 +237,8 @@ QHostInfo QSymbianHostResolver::requestHostLookup()
{
#if defined(QHOSTINFO_DEBUG)
- qDebug("QHostInfoAgent::fromName(%s) looking up...",
- hostName.toLatin1().constData());
+ qDebug("QSymbianHostResolver::requestHostLookup(%s) looking up... (id = %d)",
+ iHostName.toLatin1().constData(), id());
#endif
int err = iHostResolver.Open(iSocketServ, KAfInet, KProtocolInetUdp);
@@ -404,7 +407,7 @@ void QSymbianHostResolver::processAddressResults()
int QSymbianHostResolver::id()
{
- return iId;
+ return iResults.lookupId();
}
QSymbianHostInfoLookupManger::QSymbianHostInfoLookupManger()
@@ -428,6 +431,9 @@ void QSymbianHostInfoLookupManger::lookupFinished(QSymbianHostResolver *r)
{
QMutexLocker locker(&mutex);
+#if defined(QHOSTINFO_DEBUG)
+ qDebug() << "QSymbianHostInfoLookupManger::lookupFinished" << r->id() << "current" << iCurrentLookups.Count() << "queued" << iScheduledLookups.Count();
+#endif
// remove finished lookup from array and destroy
TInt count = iCurrentLookups.Count();
for (TInt i = 0; i < count; i++) {
@@ -442,6 +448,9 @@ void QSymbianHostInfoLookupManger::lookupFinished(QSymbianHostResolver *r)
void QSymbianHostInfoLookupManger::runNextLookup()
{
+#if defined(QHOSTINFO_DEBUG)
+ qDebug() << "QSymbianHostInfoLookupManger::runNextLookup" << "current" << iCurrentLookups.Count() << "queued" << iScheduledLookups.Count();
+#endif
// check to see if there are any scheduled lookups
if (iScheduledLookups.Count() > 0) {
// if so, move one to the current lookups and run it
@@ -458,10 +467,16 @@ void QSymbianHostInfoLookupManger::scheduleLookup(QSymbianHostResolver* r)
{
QMutexLocker locker(&mutex);
+#if defined(QHOSTINFO_DEBUG)
+ qDebug() << "QSymbianHostInfoLookupManger::scheduleLookup" << r->id() << "current" << iCurrentLookups.Count() << "queued" << iScheduledLookups.Count();
+#endif
// Check to see if we have space on the current lookups pool.
if (iCurrentLookups.Count() >= KMaxConcurrentLookups) {
// If no, schedule for later.
iScheduledLookups.Append(r);
+#if defined(QHOSTINFO_DEBUG)
+ qDebug(" - scheduled");
+#endif
return;
} else {
// If yes, add it to the current lookups.
@@ -476,6 +491,9 @@ void QSymbianHostInfoLookupManger::abortLookup(int id)
{
QMutexLocker locker(&mutex);
+#if defined(QHOSTINFO_DEBUG)
+ qDebug() << "QSymbianHostInfoLookupManger::abortLookup" << id << "current" << iCurrentLookups.Count() << "queued" << iScheduledLookups.Count();
+#endif
int i = 0;
// Find the aborted lookup by ID.
// First in the current lookups.