summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Security/MT_SSLIOP/Client_Worker.cpp
blob: 5486e50e4e6dfc2c1b5267295d9f7821cb27a42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// $Id$

#include "Client_Worker.h"
#include "tao/debug.h"

Client_Worker::Client_Worker (Simple_Server_ptr server,
                              Another_One_ptr another,
                              int niterations)
  : server_ (Simple_Server::_duplicate(server)),
    another_ (Another_One::_duplicate (another)),
    niterations_ (niterations)
{
}

void
Client_Worker::validate_connection (void)
{
  // Ping the object 100 times, ignoring all exceptions.
  // It would be better to use validate_connection() but the test must
  // run on minimum CORBA builds too!

  for (int j = 0; j != 100; ++j)
   {
      try
        {
          this->server_->test_method (j);
          this->another_->test_method (j);
          if(TAO_debug_level > 0)
            ACE_DEBUG (( LM_DEBUG,
                         "******** VALIDATED *******\n"));
        }
      catch (const CORBA::Exception&)
        {
        }
   }
}

int
Client_Worker::svc (void)
{

  try
    {
      // Validate connections befire doing any actual work..
      this->validate_connection ();

       for (int i = 0; i < this->niterations_; ++i)
         {
           this->server_->test_method (i);
           this->another_->test_method (i);

           if (TAO_debug_level > 0)
             ACE_DEBUG ((LM_DEBUG,
                         " (%P|%t) iteration = %d\n",
                         i));
         }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Client_Worker : Exception Raised");
    }
  return 0;
}