summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-03-14 14:05:27 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-03-14 14:05:27 +0000
commita157a32b9034f5c15469631b9b8c7c08897bd651 (patch)
tree33b7de54d403079ff914f02a512b4c16cb553d76
parentRemoved getLocalHost (diff)
downloadice-a157a32b9034f5c15469631b9b8c7c08897bd651.tar.bz2
ice-a157a32b9034f5c15469631b9b8c7c08897bd651.tar.xz
ice-a157a32b9034f5c15469631b9b8c7c08897bd651.zip
Removed unused getLocalHost()
-rw-r--r--cppe/src/IceE/Network.cpp88
-rw-r--r--cppe/src/IceE/Network.h1
-rwxr-xr-xcs/src/Ice/Network.cs34
-rw-r--r--java/src/IceInternal/Network.java8
4 files changed, 0 insertions, 131 deletions
diff --git a/cppe/src/IceE/Network.cpp b/cppe/src/IceE/Network.cpp
index 8309a639d8f..6e78008c9b2 100644
--- a/cppe/src/IceE/Network.cpp
+++ b/cppe/src/IceE/Network.cpp
@@ -729,94 +729,6 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
}
}
-string
-IceInternal::getLocalHost(bool numeric)
-{
- char host[1024 + 1];
- if(gethostname(host, 1024) == SOCKET_ERROR)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
-#ifdef _WIN32
-
- //
- // Windows XP has getaddrinfo(), but we don't want to require XP to run IceE.
- //
-
- //
- // gethostbyname() is thread safe on Windows, with a separate hostent per thread
- //
- struct hostent* entry;
- int retry = 5;
- do
- {
- entry = gethostbyname(host);
- }
- while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
-
- if(entry == 0)
- {
- DNSException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- ex.host = host;
- throw ex;
- }
-
- if(numeric)
- {
- struct sockaddr_in addr;
- memset(&addr, 0, sizeof(struct sockaddr_in));
- memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
- return inetAddrToString(addr.sin_addr);
- }
- else
- {
- return string(entry->h_name);
- }
-
-#else
-
- struct addrinfo* info = 0;
- int retry = 5;
-
- struct addrinfo hints = { 0 };
- hints.ai_family = PF_INET;
-
- int rs = 0;
- do
- {
- rs = getaddrinfo(host, 0, &hints, &info);
- }
- while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
-
- if(rs != 0)
- {
- DNSException ex(__FILE__, __LINE__);
- ex.error = rs;
- ex.host = host;
- throw ex;
- }
-
- string result;
- if(numeric)
- {
- assert(info->ai_family == PF_INET);
- struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
- result = inetAddrToString(sin->sin_addr);
- }
- else
- {
- result = info->ai_canonname;
- }
- freeaddrinfo(info);
- return result;
-
-#endif
-}
-
bool
IceInternal::compareAddress(const struct sockaddr_in& addr1, const struct sockaddr_in& addr2)
{
diff --git a/cppe/src/IceE/Network.h b/cppe/src/IceE/Network.h
index 4c5d4632468..d3e4011ac8c 100644
--- a/cppe/src/IceE/Network.h
+++ b/cppe/src/IceE/Network.h
@@ -99,7 +99,6 @@ void doConnect(SOCKET, struct sockaddr_in&, int);
SOCKET doAccept(SOCKET);
void getAddress(const std::string&, int, struct sockaddr_in&);
-std::string getLocalHost(bool);
bool compareAddress(const struct sockaddr_in&, const struct sockaddr_in&);
std::string errorToString(int);
diff --git a/cs/src/Ice/Network.cs b/cs/src/Ice/Network.cs
index 1e3a7899cc7..b2c515200af 100755
--- a/cs/src/Ice/Network.cs
+++ b/cs/src/Ice/Network.cs
@@ -753,40 +753,6 @@ namespace IceInternal
}
}
- public static string getLocalHost(bool numeric)
- {
- string hostname;
-
- int retry = 5;
-
- repeatGetHostName:
- try
- {
- hostname = Dns.GetHostName();
- }
- catch(Win32Exception ex)
- {
- if(ex.NativeErrorCode == WSATRY_AGAIN && --retry >= 0)
- {
- goto repeatGetHostName;
- }
- Ice.DNSException e = new Ice.DNSException("GetHostName failed", ex);
- throw e;
- }
- catch(System.Exception ex)
- {
- Ice.DNSException e = new Ice.DNSException("GetHostName failed", ex);
- throw e;
- }
-
- if(numeric)
- {
- hostname = getNumericHost(hostname);
- }
-
- return hostname;
- }
-
public static string getNumericHost(string hostname)
{
int retry = 5;
diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java
index 3694bf43963..a1d03a19b7b 100644
--- a/java/src/IceInternal/Network.java
+++ b/java/src/IceInternal/Network.java
@@ -544,14 +544,6 @@ public final class Network
}
}
- public static String
- getLocalHost(boolean numeric)
- {
- java.net.InetAddress addr = getLocalAddress();
-
- return numeric ? addr.getHostAddress() : addr.getHostName();
- }
-
public static java.net.InetAddress
getLocalAddress()
{