src/network/kernel/qhostinfo_unix.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   208     memset(&hints, 0, sizeof(hints));
   208     memset(&hints, 0, sizeof(hints));
   209     hints.ai_family = PF_UNSPEC;
   209     hints.ai_family = PF_UNSPEC;
   210 #ifdef Q_ADDRCONFIG
   210 #ifdef Q_ADDRCONFIG
   211     hints.ai_flags = Q_ADDRCONFIG;
   211     hints.ai_flags = Q_ADDRCONFIG;
   212 #endif
   212 #endif
       
   213 #ifdef Q_OS_SYMBIAN
       
   214 #   ifdef QHOSTINFO_DEBUG
       
   215         qDebug() << "Setting flags: 'hints.ai_flags &= AI_V4MAPPED | AI_ALL'";
       
   216 #   endif
       
   217 #endif
   213 
   218 
   214     int result = getaddrinfo(aceHostname.constData(), 0, &hints, &res);
   219     int result = getaddrinfo(aceHostname.constData(), 0, &hints, &res);
   215 # ifdef Q_ADDRCONFIG
   220 # ifdef Q_ADDRCONFIG
   216     if (result == EAI_BADFLAGS) {
   221     if (result == EAI_BADFLAGS) {
   217         // if the lookup failed with AI_ADDRCONFIG set, try again without it
   222         // if the lookup failed with AI_ADDRCONFIG set, try again without it
   218         hints.ai_flags = 0;
   223         hints.ai_flags = 0;
       
   224 #ifdef Q_OS_SYMBIAN
       
   225 #   ifdef QHOSTINFO_DEBUG
       
   226         qDebug() << "Setting flags: 'hints.ai_flags &= AI_V4MAPPED | AI_ALL'";
       
   227 #   endif
       
   228         hints.ai_flags &= AI_V4MAPPED | AI_ALL;
       
   229 #endif
   219         result = getaddrinfo(aceHostname.constData(), 0, &hints, &res);
   230         result = getaddrinfo(aceHostname.constData(), 0, &hints, &res);
   220     }
   231     }
   221 # endif
   232 # endif
   222 
   233 
   223     if (result == 0) {
   234     if (result == 0) {
   224         addrinfo *node = res;
   235         addrinfo *node = res;
   225         QList<QHostAddress> addresses;
   236         QList<QHostAddress> addresses;
   226         while (node) {
   237         while (node) {
       
   238 #ifdef QHOSTINFO_DEBUG
       
   239                 qDebug() << "getaddrinfo node: flags:" << node->ai_flags << "family:" << node->ai_family << "ai_socktype:" << node->ai_socktype << "ai_protocol:" << node->ai_protocol << "ai_addrlen:" << node->ai_addrlen;
       
   240 #endif
   227             if (node->ai_family == AF_INET) {
   241             if (node->ai_family == AF_INET) {
   228                 QHostAddress addr;
   242                 QHostAddress addr;
   229                 addr.setAddress(ntohl(((sockaddr_in *) node->ai_addr)->sin_addr.s_addr));
   243                 addr.setAddress(ntohl(((sockaddr_in *) node->ai_addr)->sin_addr.s_addr));
   230                 if (!addresses.contains(addr))
   244                 if (!addresses.contains(addr))
   231                     addresses.append(addr);
   245                     addresses.append(addr);