Skip to content

Commit ceefb87

Browse files
committed
Make oneway client exit after ping
1 parent 44f0309 commit ceefb87

1 file changed

Lines changed: 4 additions & 53 deletions

File tree

TAO/tests/Transport_Idle_Timeout_Oneway/client.cpp

Lines changed: 4 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,13 @@
11
#include "testC.h"
22
#include "ace/Get_Opt.h"
33
#include "ace/Log_Msg.h"
4-
#include "ace/OS_NS_sys_time.h"
54

65
static const char *ior = nullptr;
7-
static int timeout_sec = 3;
8-
9-
namespace
10-
{
11-
void
12-
wait_with_reactor (CORBA::ORB_ptr orb, int seconds)
13-
{
14-
ACE_Time_Value const deadline =
15-
ACE_OS::gettimeofday () + ACE_Time_Value (seconds);
16-
17-
while (ACE_OS::gettimeofday () < deadline)
18-
{
19-
ACE_Time_Value tv (0, 50000);
20-
orb->perform_work (tv);
21-
}
22-
}
23-
}
246

257
static int
268
parse_args (int argc, ACE_TCHAR *argv[])
279
{
28-
ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("k:t:"));
10+
ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("k:"));
2911
int c;
3012
while ((c = get_opts ()) != -1)
3113
{
@@ -34,12 +16,9 @@ parse_args (int argc, ACE_TCHAR *argv[])
3416
case 'k':
3517
ior = get_opts.opt_arg ();
3618
break;
37-
case 't':
38-
timeout_sec = ACE_OS::atoi (get_opts.opt_arg ());
39-
break;
4019
default:
4120
ACE_ERROR_RETURN ((LM_ERROR,
42-
ACE_TEXT ("Usage: client -k <ior> [-t <sec>]\n")),
21+
ACE_TEXT ("Usage: client -k <ior>\n")),
4322
-1);
4423
}
4524
}
@@ -68,37 +47,9 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
6847
ACE_TEXT ("Narrow to Test::OnewayIdle failed\n")),
6948
1);
7049

71-
int const wait_sec = timeout_sec + 2;
72-
ACE_DEBUG ((LM_INFO,
73-
ACE_TEXT ("Sending oneway ping; server waits %d seconds ")
74-
ACE_TEXT ("with idle timeout %d seconds\n"),
75-
wait_sec,
76-
timeout_sec));
77-
78-
test->ping (wait_sec);
79-
80-
// Give the server enough time to finish the oneway operation before
81-
// fetching the value it recorded while handling that operation.
82-
wait_with_reactor (orb.in (), wait_sec + 1);
83-
84-
CORBA::Long const observed = test->observed_cache_size ();
85-
if (observed != 1)
86-
{
87-
ACE_ERROR ((LM_ERROR,
88-
ACE_TEXT ("[FAIL] server cache size after oneway wait = %d; ")
89-
ACE_TEXT ("expected 1 (transport was closed)\n"),
90-
observed));
91-
test->shutdown ();
92-
orb->destroy ();
93-
return 1;
94-
}
95-
96-
ACE_DEBUG ((LM_INFO,
97-
ACE_TEXT ("[PASS] server cache size after oneway wait = %d; ")
98-
ACE_TEXT ("transport remained open\n"),
99-
observed));
50+
ACE_DEBUG ((LM_INFO, ACE_TEXT ("Sending oneway ping\n")));
51+
test->ping ();
10052

101-
test->shutdown ();
10253
orb->destroy ();
10354
}
10455
catch (const CORBA::Exception &ex)

0 commit comments

Comments
 (0)