diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-02-19 17:59:02 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-02-19 17:59:02 +0000 |
commit | 92b03a854d69c380da141f218f76623e46f455eb (patch) | |
tree | e7ed482a63b75b7de1f859dcc109775ac1d27723 /tests/SOCK_Connector_Test.cpp | |
parent | b2671ddb1a604cfdbd2a5a04b931786168818122 (diff) | |
download | ATCD-92b03a854d69c380da141f218f76623e46f455eb.tar.gz |
use ACE_DEFAULT_SERVER_HOST on LynxOS, and removed #include of sys/utsname.h because it's on OS.h
Diffstat (limited to 'tests/SOCK_Connector_Test.cpp')
-rw-r--r-- | tests/SOCK_Connector_Test.cpp | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/tests/SOCK_Connector_Test.cpp b/tests/SOCK_Connector_Test.cpp index 2472ccf98c6..ab9cad90039 100644 --- a/tests/SOCK_Connector_Test.cpp +++ b/tests/SOCK_Connector_Test.cpp @@ -4,7 +4,7 @@ // // = LIBRARY // tests -// +// // = FILENAME // SOCK_Connector_Test.cpp // @@ -14,7 +14,7 @@ // // = AUTHOR // Steve Huston -// +// // ============================================================================ #include "ace/OS.h" @@ -23,10 +23,6 @@ #include "ace/SOCK_Stream.h" #include "test_config.h" -#if !defined (ACE_WIN32) && !defined (VXWORKS) && !defined (ACE_PSOS) -#include <sys/utsname.h> -#endif /* !defined (ACE_WIN32) && !defined (VXWORKS) */ - // The original problem this program tested for was incorrectly saying // a non-blocking connect completed successfully when it didn't. The // test doesn't always work when done to localhost @@ -36,10 +32,10 @@ static void find_another_host (char other_host[]) { - ACE_OS::strcpy (other_host, ACE_DEFAULT_SERVER_HOST); // If all else fails + ACE_OS::strcpy (other_host, ACE_DEFAULT_SERVER_HOST); // If all else fails // These gethost-type things don't work everywhere. -#if !defined (ACE_WIN32) && !defined (VXWORKS) && !defined (ACE_NETBSD) && !defined (ACE_PSOS) +#if !defined (ACE_WIN32) && !defined (VXWORKS) && !defined (ACE_NETBSD) && !defined (ACE_PSOS) && !defined (__Lynx__) struct hostent *h; struct utsname un; @@ -48,26 +44,26 @@ find_another_host (char other_host[]) h = ACE_OS::gethostbyname (un.nodename); // Use me if can't find another - ACE_OS::strcpy (other_host, h->h_name); + ACE_OS::strcpy (other_host, h->h_name); // @@ We really need to add wrappers for these hostent methods. sethostent (1); - while ((h = gethostent ()) != NULL) + while ((h = gethostent ()) != NULL) { if (ACE_OS::strcmp (h->h_name, ACE_DEFAULT_SERVER_HOST) == 0) - continue; + continue; // AIX just _has_ to be different if (ACE_OS::strcmp (h->h_name, "loopback") == 0) - continue; + continue; // If not me if (ACE_OS::strcmp (h->h_name, other_host) != 0 && - ACE_OS::strcmp (h->h_name, un.nodename) != 0 ) - { - ACE_OS::strcpy (other_host, h->h_name); - break; - } + ACE_OS::strcmp (h->h_name, un.nodename) != 0 ) + { + ACE_OS::strcpy (other_host, h->h_name); + break; + } } endhostent (); @@ -90,7 +86,7 @@ fail_no_listener_nonblocking (void) status = con.connect (sock, nobody_home, &nonblock); // Need a port that will fail. - ACE_ASSERT (status == -1); + ACE_ASSERT (status == -1); // On some systems, a failed connect to localhost will return // ECONNREFUSED or ENETUNREACH directly, instead of @@ -101,28 +97,28 @@ fail_no_listener_nonblocking (void) if (sock.get_handle () != ACE_INVALID_HANDLE) status = con.complete (sock); - if (status != -1) - { - ACE_DEBUG ((LM_DEBUG, - "Connect which should fail didn't\n")); - status = -1; - } - else - { - ACE_DEBUG ((LM_DEBUG, "%p\n", "Proper fail")); - status = 0; - } + if (status != -1) + { + ACE_DEBUG ((LM_DEBUG, + "Connect which should fail didn't\n")); + status = -1; + } + else + { + ACE_DEBUG ((LM_DEBUG, "%p\n", "Proper fail")); + status = 0; + } } - else + else { ACE_DEBUG ((LM_DEBUG, - "Test not executed fully; expected EWOULDBLOCK, %p\n", - "not")); + "Test not executed fully; expected EWOULDBLOCK, %p\n", + "not")); status = -1; } // Just in case. - sock.close (); + sock.close (); return status; } @@ -140,4 +136,3 @@ main (int, char *[]) ACE_END_TEST; return status; } - |