summaryrefslogtreecommitdiff
path: root/TAO/tao/Bind_Dispatcher_Guard.cpp
blob: 2cb6869c87d5d9af8d7b13e52d9810cb6f94f930 (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
// This may look like C, but it's really -*- C++ -*-
// $Id$

#include "tao/Bind_Dispatcher_Guard.h"

#if !defined (__ACE_INLINE__)
# include "tao/Bind_Dispatcher_Guard.inl"
#endif /* ! __ACE_INLINE__ */

ACE_RCSID (tao,
           Bind_Dispatcher_Guard,
           "$Id$")

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

TAO_Bind_Dispatcher_Guard::TAO_Bind_Dispatcher_Guard (
                                         CORBA::ULong request_id,
                                         TAO_Reply_Dispatcher* rd,
                                         TAO_Transport_Mux_Strategy* tms)
 : status_(TAO_Bind_Dispatcher_Guard::UNBIND),
   request_id_(request_id),
   rd_(rd),
   tms_(tms)
{
  int const retval =
    this->tms_->bind_dispatcher (this->request_id_,
                                 this->rd_);

  if (retval == -1 )
    this->status_ =
      TAO_Bind_Dispatcher_Guard::NO_UNBIND;
}

TAO_Bind_Dispatcher_Guard::~TAO_Bind_Dispatcher_Guard (void)
{
  // We try unbinding. If it works it works, else cant do much about
  // it..
  if (this->status_ == TAO_Bind_Dispatcher_Guard::UNBIND)
    (void) this->tms_->unbind_dispatcher (this->request_id_);
}

TAO_END_VERSIONED_NAMESPACE_DECL