summaryrefslogtreecommitdiff
path: root/tests/CPP_Test.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-30 00:33:43 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-30 00:33:43 +0000
commit2d27f44666189e87ff27436b35a0dd002a0cdfd7 (patch)
treedd496dde3c016a1db5d3882e1dc40c9af7e9aaf8 /tests/CPP_Test.cpp
parent8460f65dd042d52eaaa80acfef7f288ab4ceb27a (diff)
downloadATCD-2d27f44666189e87ff27436b35a0dd002a0cdfd7.tar.gz
Eon
Diffstat (limited to 'tests/CPP_Test.cpp')
-rw-r--r--tests/CPP_Test.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/CPP_Test.cpp b/tests/CPP_Test.cpp
index 38855189b84..b2ef25a9f48 100644
--- a/tests/CPP_Test.cpp
+++ b/tests/CPP_Test.cpp
@@ -41,6 +41,7 @@ client (void *arg)
#endif /* (defined (ACE_WIN32) || defined (VXWORKS)) && defined (ACE_HAS_THREADS) */
ACE_INET_Addr *remote_addr = (ACE_INET_Addr *) arg;
+ ACE_INET_Addr server_addr (remote_addr->get_port_number (), "localhost");
ACE_SOCK_Stream cli_stream;
ACE_SOCK_Connector con;
@@ -49,7 +50,7 @@ client (void *arg)
// Attempt a non-blocking connect to the server, reusing the local
// addr if necessary.
- if (con.connect (cli_stream, *remote_addr,
+ if (con.connect (cli_stream, server_addr,
(ACE_Time_Value *) &ACE_Time_Value::zero) == -1)
{
if (errno != EWOULDBLOCK)
@@ -61,11 +62,11 @@ client (void *arg)
// and wait up to ACE_DEFAULT_TIMEOUT seconds for it to complete.
ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT);
- if (con.complete (cli_stream, remote_addr, &tv) == -1)
- ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n", "connection failed"));
+ if (con.complete (cli_stream, &server_addr, &tv) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "connection failed"), 0);
else
ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected to %s\n",
- remote_addr->get_host_name ()));
+ server_addr.get_host_name ()));
}
if (cli_stream.disable (ACE_NONBLOCK) == -1)
@@ -233,11 +234,11 @@ spawn (void)
}
#elif defined (ACE_HAS_THREADS)
if (ACE_Service_Config::thr_mgr ()->spawn
- (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1)
+ (ACE_THR_FUNC (server), (void *) &peer_acceptor, THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed"));
if (ACE_Service_Config::thr_mgr ()->spawn
- (ACE_THR_FUNC (server), (void *) &peer_acceptor, THR_NEW_LWP | THR_DETACHED) == -1)
+ (ACE_THR_FUNC (client), (void *) &server_addr, THR_NEW_LWP | THR_DETACHED) == -1)
ACE_ERROR ((LM_ERROR, "(%P|%t) %p\n%a", "thread create failed"));
// Wait for the threads to exit.