summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/kernel/qhostinfo_p.h5
-rw-r--r--src/network/kernel/qhostinfo_symbian.cpp64
2 files changed, 38 insertions, 31 deletions
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index 79fad84..909bd03 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -228,7 +228,7 @@ public:
QSymbianHostResolver(const QString &hostName, int id);
~QSymbianHostResolver();
- QHostInfo requestHostLookup();
+ void requestHostLookup();
int id();
QHostInfoResult resultEmitter;
@@ -258,7 +258,8 @@ private:
enum {
EIdle,
EGetByName,
- EGetByAddress
+ EGetByAddress,
+ EError
} iState;
};
diff --git a/src/network/kernel/qhostinfo_symbian.cpp b/src/network/kernel/qhostinfo_symbian.cpp
index ad5f38a..54ec33c 100644
--- a/src/network/kernel/qhostinfo_symbian.cpp
+++ b/src/network/kernel/qhostinfo_symbian.cpp
@@ -233,7 +233,7 @@ QSymbianHostResolver::~QSymbianHostResolver()
}
// Async equivalent to QHostInfoAgent::fromName()
-QHostInfo QSymbianHostResolver::requestHostLookup()
+void QSymbianHostResolver::requestHostLookup()
{
#if defined(QHOSTINFO_DEBUG)
@@ -245,45 +245,51 @@ QHostInfo QSymbianHostResolver::requestHostLookup()
if (err) {
// What are we doing with iResults??
iResults.setError(QHostInfo::UnknownError);
- iResults.setErrorString(QObject::tr("Symbian error code: %1").arg(err));
+ iResults.setErrorString(QSystemError(err, QSystemError::NativeError).toString());
- iHostResolver.Close();
- return iResults;
- }
+ } else {
- if (iAddress.setAddress(iHostName)) {
- // Reverse lookup
+ if (iAddress.setAddress(iHostName)) {
+ // Reverse lookup
- TInetAddr IpAdd;
- IpAdd.Input(qt_QString2TPtrC(iHostName));
+ TInetAddr IpAdd;
+ IpAdd.Input(qt_QString2TPtrC(iHostName));
- // Asynchronous request.
- iHostResolver.GetByAddress(IpAdd, iNameResult, iStatus); // <---- ASYNC
- iState = EGetByAddress;
+ // Asynchronous request.
+ iHostResolver.GetByAddress(IpAdd, iNameResult, iStatus); // <---- ASYNC
+ iState = EGetByAddress;
- } else {
+ } else {
- // IDN support
- QByteArray aceHostname = QUrl::toAce(iHostName);
- iResults.setHostName(iHostName);
- if (aceHostname.isEmpty()) {
- iResults.setError(QHostInfo::HostNotFound);
- iResults.setErrorString(iHostName.isEmpty() ?
- QCoreApplication::translate("QHostInfoAgent", "No host name given") :
- QCoreApplication::translate("QHostInfoAgent", "Invalid hostname"));
+ // IDN support
+ QByteArray aceHostname = QUrl::toAce(iHostName);
+ iResults.setHostName(iHostName);
+ if (aceHostname.isEmpty()) {
+ iResults.setError(QHostInfo::HostNotFound);
+ iResults.setErrorString(iHostName.isEmpty() ?
+ QCoreApplication::translate("QHostInfoAgent", "No host name given") :
+ QCoreApplication::translate("QHostInfoAgent", "Invalid hostname"));
- iHostResolver.Close();
- return iResults;
- }
+ err = KErrArgument;
+ } else {
- // Asynchronous request.
- iHostResolver.GetByName(qt_QString2TPtrC(QString::fromLatin1(aceHostname)), iNameResult, iStatus);
- iState = EGetByName;
+ // Asynchronous request.
+ iHostResolver.GetByName(qt_QString2TPtrC(QString::fromLatin1(aceHostname)), iNameResult, iStatus);
+ iState = EGetByName;
+ }
+ }
}
-
SetActive();
+ if (err) {
+ iHostResolver.Close();
- return iResults;
+ //self complete so that RunL can inform manager without causing recursion
+ iState = EError;
+ iStatus = KRequestPending;
+ SetActive();
+ TRequestStatus* stat = &iStatus;
+ User::RequestComplete(stat, err);
+ }
}
void QSymbianHostResolver::DoCancel()