diff options
| author | Alan Conway <aconway@apache.org> | 2008-11-12 15:42:24 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-11-12 15:42:24 +0000 |
| commit | 09d5ff587285976f89d80585dc7e766bcf3f5b82 (patch) | |
| tree | 7719a872810177448ebf506f7b0858636c2a0012 /qpid/cpp/src | |
| parent | 79b34abf468ba9d190a24562e335f128df0e1d0e (diff) | |
| download | qpid-python-09d5ff587285976f89d80585dc7e766bcf3f5b82.tar.gz | |
Fix problem where broker generates empty URL if run on a host with only the 127.0.0.1 loopback interface.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@713405 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rwxr-xr-x | qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp b/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp index c054931a96..9bbd023e29 100755 --- a/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp +++ b/qpid/cpp/src/qpid/sys/posix/SystemInfo.cpp @@ -53,11 +53,10 @@ bool SystemInfo::getLocalHostname (TcpAddress &address) { return true; } +static const string LOCALHOST("127.0.0.1"); + void SystemInfo::getLocalIpAddresses (uint16_t port, std::vector<Address> &addrList) { - - static const string LOCALHOST("127.0.0.1"); - int s = socket (PF_INET, SOCK_STREAM, 0); for (int i=1;;i++) { struct ifreq ifr; @@ -72,6 +71,9 @@ void SystemInfo::getLocalIpAddresses (uint16_t port, if (addr != LOCALHOST) addrList.push_back(TcpAddress(addr, port)); } + if (addrList.empty()) { + addrList.push_back(TcpAddress(LOCALHOST, port)); + } close (s); } |
