fixed testChannelAccess

This commit is contained in:
Matej Sekoranja
2015-12-16 13:52:56 +01:00
parent 22d6db2818
commit 91b5cc707d
4 changed files with 31 additions and 31 deletions

View File

@@ -26,6 +26,7 @@ namespace pvAccess {
void addDefaultBroadcastAddress(InetAddrVector* v, unsigned short p) {
osiSockAddr pNewNode;
pNewNode.ia.sin_family = AF_INET;
// TODO this does not work in case of no active interfaces, should return 127.0.0.1 then
pNewNode.ia.sin_addr.s_addr = htonl(INADDR_BROADCAST);
pNewNode.ia.sin_port = htons(p);
v->push_back(pNewNode);
@@ -47,6 +48,9 @@ InetAddrVector* getBroadcastAddresses(SOCKET sock,
v->push_back(sn->addr);
}
ellFree(&as);
// add fallback address
if (!v->size())
addDefaultBroadcastAddress(v, defaultPort);
return v;
}