Skip to content

Commit 002ef16

Browse files
Peter Hartmannphartmann
Peter Hartmann
authored andcommitted
[BB10-internal] BB10 bearer plugin: populate list of host addresses
... so the sockets will know which address to bind to in case a non- default interface should be used. Change-Id: Ice0f946bf265fda50bd538a1f26d5fdd7a0dbd70 Signed-off-by: Peter Hartmann <[email protected]>
1 parent cff0b9e commit 002ef16

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/plugins/bearer/blackberry/qbbengine.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <QThreadStorage>
4747
#include <QStringList>
4848
#include <QTimer>
49+
#include <QHostAddress>
4950

5051
#include <bps/netstatus.h>
5152

@@ -333,6 +334,14 @@ void QBBEngine::updateConfiguration(const char *interface)
333334

334335
const netstatus_interface_type_t type = netstatus_interface_get_type(details);
335336
const netstatus_ip_status_t ipStatus = netstatus_interface_get_ip_status(details);
337+
const int numIpAddresses = netstatus_interface_get_num_ip_addresses(details);
338+
QList<QHostAddress> hostAddresses;
339+
for (int a = 0; a < numIpAddresses; ++a) {
340+
const char *ipAddress = netstatus_interface_get_ip_address(details, a);
341+
QHostAddress hostAddress(QString::fromLatin1(ipAddress));
342+
if (!hostAddress.isNull())
343+
hostAddresses.append(hostAddress);
344+
}
336345

337346
netstatus_free_interface_details(&details);
338347

@@ -370,6 +379,11 @@ void QBBEngine::updateConfiguration(const char *interface)
370379
changed = true;
371380
}
372381

382+
if (ptr->hostAddresses != hostAddresses) {
383+
ptr->hostAddresses = hostAddresses;
384+
changed = true;
385+
}
386+
373387
const netstatus_ip_status_t oldIpStatus = ptr->oldIpStatus;
374388
ptr->oldIpStatus = ipStatus;
375389

0 commit comments

Comments
 (0)