diff options
author | Steve Huston <shuston@riverace.com> | 2004-11-19 23:21:58 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2004-11-19 23:21:58 +0000 |
commit | 2eb36ea873de90237dd1e708fa38242f63f49129 (patch) | |
tree | afa786575b951a94124543841addee3453add6b7 /tests/HTBP | |
parent | a2184f617712034e6098c841a21f65f712efe8d3 (diff) | |
download | ATCD-2eb36ea873de90237dd1e708fa38242f63f49129.tar.gz |
ChangeLogTag:Fri Nov 19 18:19:19 2004 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'tests/HTBP')
-rw-r--r-- | tests/HTBP/Reactor_Tests/server.cpp | 40 | ||||
-rw-r--r-- | tests/HTBP/ping/server.cpp | 67 |
2 files changed, 63 insertions, 44 deletions
diff --git a/tests/HTBP/Reactor_Tests/server.cpp b/tests/HTBP/Reactor_Tests/server.cpp index 8799880f400..3e6146e2f3f 100644 --- a/tests/HTBP/Reactor_Tests/server.cpp +++ b/tests/HTBP/Reactor_Tests/server.cpp @@ -80,7 +80,8 @@ Accept_Handler::handle_input (ACE_HANDLE h) } if (ch == 0) ACE_ERROR_RETURN ((LM_ERROR, - "Accept_Handler::handle_input, unknown handle %d\n",h), + ACE_TEXT ("Accept_Handler::handle_input, ") + ACE_TEXT ("unknown handle %d\n") ,h), -1); int result = (*ch)->pre_recv(); if (result == 0) @@ -97,18 +98,20 @@ Accept_Handler::handle_input (ACE_HANDLE h) if (handler == 0) { - ACE_DEBUG ((LM_DEBUG,"Creating new stream handler for %d\n", + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Creating new stream handler for %d\n"), stream->get_handle())); Stream_Handler *sh = new Stream_Handler(*stream); session->handler (sh); } else - ACE_DEBUG ((LM_DEBUG,"There is already a handler for %d\n", + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("There is already a handler for %d\n"), stream->get_handle())); if ((*ch)->state() == ACE::HTBP::Channel::Data_Queued) { - ACE_DEBUG ((LM_DEBUG,"Issuing notification on handler\n")); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Issuing notification on handler\n"))); this->reactor()->notify (session->handler(), ACE_Event_Handler::READ_MASK); } @@ -132,43 +135,44 @@ Stream_Handler::handle_input (ACE_HANDLE h) ssize_t n = this->stream_.recv (buffer,1000); if (n == -1) ACE_ERROR_RETURN ((LM_ERROR, - "Stream_Handler::handle_input %p\n","recv"),0); + ACE_TEXT ("Stream_Handler::handle_input %p\n"), + ACE_TEXT ("recv")), + 0); buffer[n] = 0; - ACE_DEBUG ((LM_DEBUG,"Stream_Handler::handle_input (%d) read %d:\n%s\n", - h,n,buffer)); - if (ACE_OS::strstr (buffer,"goodbye") != 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Stream_Handler::handle_input (%d) read %d:\n%C\n"), + h, n, buffer)); + if (ACE_OS::strstr (buffer, "goodbye") != 0) this->reactor()->end_event_loop(); else { ACE::HTBP::Channel *ch = stream_.session()->outbound(); if (ch != 0) ACE_DEBUG ((LM_DEBUG, - "Sending reply on %d\n", + ACE_TEXT ("Sending reply on %d\n"), ch->ace_stream().get_handle())); else ACE_DEBUG ((LM_DEBUG, - "Can't send reply on nul channel\n")); + ACE_TEXT ("Can't send reply on nul channel\n"))); this->stream_.send ("Back atcha!",11); } return 0; } int -main (int argc, char *argv[]) +ACE_TMAIN (int, ACE_TCHAR *[]) { - ACE_UNUSED_ARG (argc); - ACE_UNUSED_ARG (argv); - ACE_DEBUG ((LM_DEBUG,"At start of main\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("At start of main\n"))); ACE_OS::socket_init (ACE_WSOCK_VERSION); ACE_INET_Addr local(8088); - ACE_DEBUG ((LM_DEBUG,"got address\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("got address\n"))); ACE_SOCK_Acceptor acc(local,1); - ACE_DEBUG ((LM_DEBUG,"opened listener\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("opened listener\n"))); Accept_Handler handler (acc); - ACE_DEBUG ((LM_DEBUG,"server is ready\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("server is ready\n"))); - ACE_Reactor::instance()->run_event_loop(); + ACE_Reactor::instance()->run_reactor_event_loop(); return 0; } diff --git a/tests/HTBP/ping/server.cpp b/tests/HTBP/ping/server.cpp index becd2175650..d20d46b8b09 100644 --- a/tests/HTBP/ping/server.cpp +++ b/tests/HTBP/ping/server.cpp @@ -14,11 +14,8 @@ #include "ace/SOCK_Stream.h" int -main (int argc, char *argv[]) +ACE_TMAIN (int, ACE_TCHAR *[]) { - ACE_UNUSED_ARG (argc); - ACE_UNUSED_ARG (argv); - char buffer[1000]; ssize_t n = 0; @@ -27,35 +24,46 @@ main (int argc, char *argv[]) ACE_INET_Addr local(8088); ACE_SOCK_Stream sock[2]; ACE_SOCK_Acceptor acc(local,1); - ACE_DEBUG ((LM_DEBUG,"server is ready\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("server is ready\n"))); - acc.accept(sock[0]); + acc.accept (sock[0]); ACE::HTBP::Channel channel1(sock[0]); - ACE_DEBUG ((LM_DEBUG,"Got sock[0], handle = %d\n",sock[0].get_handle())); - acc.accept(sock[1]); - ACE::HTBP::Channel channel2(sock[1]); - ACE_DEBUG ((LM_DEBUG,"Got sock[1], handle = %d\n",sock[1].get_handle())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Got sock[0], handle = %d\n"), + sock[0].get_handle())); + acc.accept (sock[1]); + ACE::HTBP::Channel channel2 (sock[1]); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Got sock[1], handle = %d\n"), + sock[1].get_handle())); int res = 0; - while ((res =channel1.pre_recv()) != 0) + while ((res = channel1.pre_recv ()) != 0) { - ACE_DEBUG ((LM_DEBUG,"res = %d. waiting 1 sec. %p\n",res, - "stream.pre_recv()")); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("res = %d. waiting 1 sec. %p\n"), + res, + ACE_TEXT ("stream.pre_recv()"))); ACE_OS::sleep (1); } - ACE_DEBUG ((LM_DEBUG,"Read from channel2\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Read from channel2\n"))); while ((res = channel2.pre_recv()) != 0) { - ACE_DEBUG ((LM_DEBUG,"res = %d, waiting 1 sec. %p\n",res, - "stream2.pre_recv()")); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("res = %d, waiting 1 sec. %p\n"), + res, + ACE_TEXT ("stream2.pre_recv()"))); ACE_OS::sleep (1); } ACE::HTBP::Session *session = channel1.session(); ACE::HTBP::Stream stream (session); - ACE_DEBUG ((LM_DEBUG,"using streams %d, %d. Got sesssion = %x\n", - sock[0].get_handle(),sock[1].get_handle(),session)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("using streams %d, %d. Got sesssion = %@\n"), + sock[0].get_handle(), + sock[1].get_handle(), + session)); for (int i = 0; i >= 0; i++) { @@ -65,7 +73,8 @@ main (int argc, char *argv[]) && retrycount > 0) { retrycount--; - ACE_DEBUG ((LM_DEBUG,"waiting for inbound data, %d tries left\n", + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("waiting for inbound data, %d tries left\n"), retrycount)); ACE_OS::sleep(1); } @@ -74,7 +83,7 @@ main (int argc, char *argv[]) buffer[n] = 0; - ACE_DEBUG ((LM_DEBUG,"Got: \"%s\"\n",buffer)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Got: \"%C\"\n"), buffer)); if (ACE_OS::strstr (buffer,"goodbye") != 0) break; @@ -82,9 +91,11 @@ main (int argc, char *argv[]) ACE_OS::sprintf (buffer,"I hear you %d",i); n = stream.send (buffer,ACE_OS::strlen(buffer)+1); if (n == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n","stream.send"),-1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("stream.send")), + -1); - ACE_DEBUG ((LM_DEBUG,"Send returned %d\n",n)); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Send returned %d\n"), n)); int got[2] = {-1,-1}; while (got[0] == -1 || got[1] == -1) @@ -92,14 +103,18 @@ main (int argc, char *argv[]) if (got[0] == -1) { if ((got[0] = (res =channel1.pre_recv())) == -1) - ACE_DEBUG ((LM_DEBUG,"res = %d, waiting 1 sec. %p\n",got[0], - "channel1.pre_recv()")); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("res = %d, waiting 1 sec. %p\n"), + got[0], + ACE_TEXT ("channel1.pre_recv()"))); } if (got[1] == -1) { if ((got[1] = (res =channel2.pre_recv())) == -1) - ACE_DEBUG ((LM_DEBUG,"res = %d, waiting 1 sec. %p\n",got[1], - "channel2.pre_recv()")); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("res = %d, waiting 1 sec. %p\n"), + got[1], + ACE_TEXT ("channel2.pre_recv()"))); } if (got[0] == -1 || got[1] == -1) ACE_OS::sleep (1); |