diff options
| author | Adrian Frühwirth <af@bonki.net> | 2015-11-24 22:56:02 +0100 |
|---|---|---|
| committer | Adrian Frühwirth <af@bonki.net> | 2015-11-24 22:56:02 +0100 |
| commit | 038476c41204e2fb5c82934beefbd50d8d28c4f8 (patch) | |
| tree | b6348d0f05d676c42b14161732e8ed5228ecacdb /service/OneService.cpp | |
| parent | 1fde17bacb565bfc1536ef83276658e8bb6f0a0c (diff) | |
| download | infinitytier-038476c41204e2fb5c82934beefbd50d8d28c4f8.tar.gz infinitytier-038476c41204e2fb5c82934beefbd50d8d28c4f8.zip | |
Fix for GitHub issue #253.
Make 'ip' detection more robust (some distros don't ship the binary in /sbin or /usr/sbin).
Add error handling for cases where an ip add/remove fails.
Diffstat (limited to 'service/OneService.cpp')
| -rw-r--r-- | service/OneService.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index a912c830..8e21fc5f 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -1147,11 +1147,13 @@ public: newAssignedIps.erase(std::unique(newAssignedIps.begin(),newAssignedIps.end()),newAssignedIps.end()); for(std::vector<InetAddress>::iterator ip(newAssignedIps.begin());ip!=newAssignedIps.end();++ip) { if (!std::binary_search(assignedIps.begin(),assignedIps.end(),*ip)) - t->second->addIp(*ip); + if (!t->second->addIp(*ip)) + fprintf(stderr,"ERROR: unable to add ip address %s"ZT_EOL_S, ip->toString().c_str()); } for(std::vector<InetAddress>::iterator ip(assignedIps.begin());ip!=assignedIps.end();++ip) { if (!std::binary_search(newAssignedIps.begin(),newAssignedIps.end(),*ip)) - t->second->removeIp(*ip); + if (!t->second->removeIp(*ip)) + fprintf(stderr,"ERROR: unable to remove ip address %s"ZT_EOL_S, ip->toString().c_str()); } assignedIps.swap(newAssignedIps); } else { |
