00001 // This may look like C, but it's really -*- C++ -*- 00002 // $Id: Bind_Dispatcher_Guard.cpp 79829 2007-10-23 12:39:52Z johnnyw $ 00003 00004 #include "tao/Bind_Dispatcher_Guard.h" 00005 00006 #if !defined (__ACE_INLINE__) 00007 # include "tao/Bind_Dispatcher_Guard.inl" 00008 #endif /* ! __ACE_INLINE__ */ 00009 00010 ACE_RCSID (tao, 00011 Bind_Dispatcher_Guard, 00012 "$Id: Bind_Dispatcher_Guard.cpp 79829 2007-10-23 12:39:52Z johnnyw $") 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 TAO_Bind_Dispatcher_Guard::TAO_Bind_Dispatcher_Guard (CORBA::ULong request_id, 00017 TAO_Reply_Dispatcher *rd, 00018 TAO_Transport_Mux_Strategy *tms) 00019 : status_(TAO_Bind_Dispatcher_Guard::UNBIND), 00020 request_id_(request_id), 00021 rd_(rd), 00022 tms_(tms) 00023 { 00024 int const retval = 00025 this->tms_->bind_dispatcher (this->request_id_, this->rd_); 00026 00027 if (retval == -1) 00028 this->status_ = TAO_Bind_Dispatcher_Guard::NO_UNBIND; 00029 } 00030 00031 TAO_Bind_Dispatcher_Guard::~TAO_Bind_Dispatcher_Guard (void) 00032 { 00033 // We try unbinding. If it works it works, else cant do much about 00034 // it.. 00035 if (this->status_ == TAO_Bind_Dispatcher_Guard::UNBIND) 00036 (void)this->tms_->unbind_dispatcher (this->request_id_); 00037 } 00038 00039 TAO_END_VERSIONED_NAMESPACE_DECL