summaryrefslogtreecommitdiff
path: root/TAO/tests/DIOP/UDP_i.cpp
blob: dd8e91c847bde39f502797897b148684b5f6e71e (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
64
65
66
67
#include "UDP_i.h"

// Constructor
UDP_i::UDP_i (CORBA::ORB_ptr o) :
  orb_(CORBA::ORB::_duplicate (o))
{
}

// Destructor
UDP_i::~UDP_i ()
{
}

void
UDP_i::invoke (const char * client_name,
               UDP_ptr udpHandler,
               CORBA::Long request_id)
{
  try
    {
      ACE_DEBUG ((LM_DEBUG,
                  "UDP_i::invoke: name = %C request id = %d.\n",
                  client_name,
                  request_id));

      CORBA::Long last_request_id = 0;
      if (request_id_table_.find (client_name,
                                  last_request_id) != -1)
        {
          if (last_request_id + 1 != request_id)
            ACE_ERROR ((LM_ERROR,
                        "UDP_i::invoke: failure on %C expected id = %d, got %d\n",
                        client_name,
                        last_request_id+1,
                        request_id));
        }

      request_id_table_.rebind (client_name,
                                request_id);

      if (!CORBA::is_nil (udpHandler))
        {
          udpHandler->invoke (client_name,
                              UDP::_nil (),
                              request_id);
        }

    }
  catch (const CORBA::Exception&)
    {
       ACE_ERROR ((LM_ERROR,
                   "UDP_i::svc: Received exception\n"));
    }
}

// Shutdown.

void
UDP_i::shutdown ()
{
  ACE_DEBUG ((LM_DEBUG,
              "UDP_i is shutting down\n"));

  // Instruct the ORB to shutdown.
  this->orb_->shutdown ();
}