diff options
Diffstat (limited to 'fastos')
-rw-r--r-- | fastos/src/tests/sockettest.cpp | 68 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_socket.cpp | 29 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/unix_socket.h | 2 |
3 files changed, 1 insertions, 98 deletions
diff --git a/fastos/src/tests/sockettest.cpp b/fastos/src/tests/sockettest.cpp index 9a655548d97..c356ddfc93f 100644 --- a/fastos/src/tests/sockettest.cpp +++ b/fastos/src/tests/sockettest.cpp @@ -654,9 +654,6 @@ public: // Fallback to localhost if we can't get the hostname std::string strictBindHost("localhost"); - std::string hostName = FastOS_Socket::getHostName(); - if(!hostName.empty()) - strictBindHost = hostName; FastOS_ServerSocket *serverSocket = new FastOS_ServerSocket(18333, 5, NULL, strictBindHost.c_str()); @@ -812,68 +809,6 @@ public: PrintSeparator(); } - void HostNameTest () - { - std::string errorMessage; - std::string hostName; - - TestHeader("Hostname Test"); - - hostName = FastOS_Socket::getHostName(&errorMessage); - - if(!hostName.empty()) - { - Progress(true, "Got hostname: [%s]", hostName.c_str()); - - - } - else - { - Progress(false, "Error getting hostname:\n%s", errorMessage.c_str()); - } - - PrintSeparator(); - } - - void HostAddressTest (bool testWithFailure) - { - std::string errorMessage; - - if (!testWithFailure) - { - TestHeader("Hostaddress Test"); - } - else - { - TestHeader("Provoked Hostaddress Failure Test"); - } - - std::string hostName; - - hostName = FastOS_Socket::getHostName(&errorMessage); - - if (!hostName.empty()) - { - if (testWithFailure) - { - Progress(true, "Got FQ Hostname: [%s], but will use ZZZZ instead", - hostName.c_str()); - hostName = "ZZZZ"; - } - else - { - Progress(true, "Got FQ Hostname: [%s]", - hostName.c_str()); - } - } - else - { - Progress(false, "Error getting hostname:\n%s", errorMessage.c_str()); - } - - PrintSeparator(); - } - int Main () override { printf("This test should be run in the 'test/workarea' directory.\n\n"); @@ -892,9 +827,6 @@ public: } } - HostNameTest(); - HostAddressTest(false); - HostAddressTest(true); HttpClientTest(); ClientServerTest(); StrictBindTest(); diff --git a/fastos/src/vespa/fastos/unix_socket.cpp b/fastos/src/vespa/fastos/unix_socket.cpp index a6cce42bfad..7f08a8dd9a3 100644 --- a/fastos/src/vespa/fastos/unix_socket.cpp +++ b/fastos/src/vespa/fastos/unix_socket.cpp @@ -84,34 +84,6 @@ ssize_t FastOS_UNIX_Socket::Read (void *readBuffer, size_t bufferSize) std::string -FastOS_UNIX_Socket::getHostName(std::string * errorMsg) -{ - char buffer[MAXHOSTNAMELEN]; - if (gethostname(buffer, sizeof(buffer)) < 0) { - if (errorMsg != NULL) { - int errnoCopy = errno; - // Malloc calculations here are not 100% correct (does not compensate - // for printf codes). Allocating a few extra bytes isn't farmful though. - const char errorUname[]="Failed to use gethostname() to get host name: %s"; - char errorBuf[100]; - const char *errorString = strerror_r(errnoCopy, errorBuf, sizeof(errorBuf)); - char *errorMsgC = static_cast<char *> - (malloc(strlen(errorUname) + - strlen(errorString) + 1)); - sprintf(errorMsgC, errorUname, errorString); - *errorMsg = errorMsgC; - free(errorMsgC); - } - } else { - buffer[sizeof(buffer) - 1] = '\0'; - return std::string(buffer); - } - - return std::string(); -} - - -std::string FastOS_UNIX_Socket::getErrorString(int error) { char errorBuf[100]; @@ -119,6 +91,7 @@ FastOS_UNIX_Socket::getErrorString(int error) return std::string(errorString); } + bool FastOS_SocketEventObjects::Init (FastOS_SocketEvent *event) { (void)event; diff --git a/fastos/src/vespa/fastos/unix_socket.h b/fastos/src/vespa/fastos/unix_socket.h index 9905e00f9cf..9626ac41716 100644 --- a/fastos/src/vespa/fastos/unix_socket.h +++ b/fastos/src/vespa/fastos/unix_socket.h @@ -15,8 +15,6 @@ public: ssize_t Read (void *readBuffer, size_t bufferSize) override; ssize_t Write (const void *writeBuffer, size_t bufferSize) override; - static std::string getHostName(std::string *errorMsg); - static std::string getHostName() { return getHostName(nullptr); } static int GetLastError () { return errno; } static std::string getErrorString(int error); |