#include <UIPMC_Mcast_Connection_Handler.h>
Inheritance diagram for TAO_UIPMC_Mcast_Connection_Handler:
Public Member Functions | |
TAO_UIPMC_Mcast_Connection_Handler (ACE_Thread_Manager *t=0) | |
TAO_UIPMC_Mcast_Connection_Handler (TAO_ORB_Core *orb_core) | |
~TAO_UIPMC_Mcast_Connection_Handler (void) | |
Destructor. | |
int | close (u_long=0) |
int | add_transport_to_cache (void) |
Add ourselves to Cache. | |
const ACE_INET_Addr & | addr (void) |
void | addr (const ACE_INET_Addr &addr) |
const ACE_INET_Addr & | local_addr (void) |
void | local_addr (const ACE_INET_Addr &addr) |
ssize_t | send (const iovec iov[], int n, const ACE_Addr &addr, int flags=0) const |
Connection Handler overloads | |
virtual int | open_handler (void *v) |
Event Handler overloads | |
virtual int | resume_handler (void) |
virtual int | close_connection (void) |
virtual int | handle_input (ACE_HANDLE) |
virtual int | handle_output (ACE_HANDLE) |
virtual int | handle_close (ACE_HANDLE, ACE_Reactor_Mask) |
virtual int | handle_timeout (const ACE_Time_Value ¤t_time, const void *act=0) |
virtual int | open (void *) |
Protected Member Functions | |
TAO_Connection Handler overloads | |
virtual int | release_os_resources (void) |
Protected Attributes | |
ACE_INET_Addr | addr_ |
ACE_INET_Addr | local_addr_ |
Since MIOP is asymmetric then this Connection handler is for only use in the Acceptor.
Definition at line 54 of file UIPMC_Mcast_Connection_Handler.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_UIPMC_Mcast_Connection_Handler::TAO_UIPMC_Mcast_Connection_Handler | ( | ACE_Thread_Manager * | t = 0 |
) |
Definition at line 28 of file UIPMC_Mcast_Connection_Handler.cpp.
References ACE_ASSERT.
00030 : TAO_UIPMC_MCAST_SVC_HANDLER (t, 0 , 0), 00031 TAO_Connection_Handler (0) 00032 { 00033 // This constructor should *never* get called, it is just here to 00034 // make the compiler happy: the default implementation of the 00035 // Creation_Strategy requires a constructor with that signature, we 00036 // don't use that implementation, but some (most?) compilers 00037 // instantiate it anyway. 00038 ACE_ASSERT (0); 00039 }
TAO_UIPMC_Mcast_Connection_Handler::TAO_UIPMC_Mcast_Connection_Handler | ( | TAO_ORB_Core * | orb_core | ) |
Constructor. <arg> parameter is used by the Acceptor to pass the protocol configuration properties for this connection.
Definition at line 41 of file UIPMC_Mcast_Connection_Handler.cpp.
References ACE_NEW, TAO_Connection_Handler::orb_core(), and TAO_Connection_Handler::transport().
00043 : TAO_UIPMC_MCAST_SVC_HANDLER (orb_core->thr_mgr (), 0, 0), 00044 TAO_Connection_Handler (orb_core) 00045 { 00046 UIPMC_MULTICAST_TRANSPORT* specific_transport = 0; 00047 ACE_NEW(specific_transport, 00048 UIPMC_MULTICAST_TRANSPORT (this, orb_core)); 00049 00050 // store this pointer (indirectly increment ref count) 00051 this->transport (specific_transport); 00052 }
TAO_UIPMC_Mcast_Connection_Handler::~TAO_UIPMC_Mcast_Connection_Handler | ( | void | ) |
Destructor.
Definition at line 54 of file UIPMC_Mcast_Connection_Handler.cpp.
References ACE_ERROR, ACE_TEXT(), LM_ERROR, release_os_resources(), TAO_debug_level, and TAO_Connection_Handler::transport().
00055 { 00056 delete this->transport (); 00057 int const result = 00058 this->release_os_resources (); 00059 00060 if (result == -1 && TAO_debug_level) 00061 { 00062 ACE_ERROR ((LM_ERROR, 00063 ACE_TEXT("TAO (%P|%t) - UIPMC_Mcast_Connection_Handler::") 00064 ACE_TEXT("~UIPMC_Mcast_Connection_Handler, ") 00065 ACE_TEXT("release_os_resources() failed %m\n"))); 00066 } 00067 }
int TAO_UIPMC_Mcast_Connection_Handler::add_transport_to_cache | ( | void | ) |
Add ourselves to Cache.
Definition at line 210 of file UIPMC_Mcast_Connection_Handler.cpp.
References addr(), TAO_ORB_Core::lane_resources(), TAO_Connection_Handler::orb_core(), and TAO_Thread_Lane_Resources::transport_cache().
00211 { 00212 ACE_INET_Addr addr; 00213 00214 // This function is called by the acceptor to add this 00215 // transport to the transport cache. This is really 00216 // important for proper shutdown. The address used 00217 // is irrelevent, since UIPMC is connectionless. 00218 00219 // Construct a UIPMC_Endpoint object. 00220 TAO_UIPMC_Endpoint endpoint (addr); 00221 00222 // Construct a property object 00223 TAO_Base_Transport_Property prop (&endpoint); 00224 00225 // Add the handler to Cache 00226 return this->orb_core ()->lane_resources () 00227 .transport_cache ().cache_transport (&prop, 00228 this->transport ()); 00229 }
void TAO_UIPMC_Mcast_Connection_Handler::addr | ( | const ACE_INET_Addr & | addr | ) |
const ACE_INET_Addr & TAO_UIPMC_Mcast_Connection_Handler::addr | ( | void | ) |
Definition at line 70 of file UIPMC_Mcast_Connection_Handler.cpp.
References addr_.
Referenced by add_transport_to_cache(), addr(), and local_addr().
00071 { 00072 return this->addr_; 00073 }
int TAO_UIPMC_Mcast_Connection_Handler::close | ( | u_long | = 0 |
) |
Close called by the Acceptor or Connector when connection establishment fails.
Definition at line 198 of file UIPMC_Mcast_Connection_Handler.cpp.
References TAO_Connection_Handler::close_handler().
Referenced by handle_timeout(), and TAO_UIPMC_Acceptor::open_i().
00199 { 00200 return this->close_handler (); 00201 }
int TAO_UIPMC_Mcast_Connection_Handler::close_connection | ( | void | ) | [virtual] |
Implements TAO_Connection_Handler.
Definition at line 136 of file UIPMC_Mcast_Connection_Handler.cpp.
References TAO_Connection_Handler::close_connection_eh().
Referenced by handle_output().
00137 { 00138 return this->close_connection_eh (this); 00139 }
int TAO_UIPMC_Mcast_Connection_Handler::handle_close | ( | ACE_HANDLE | , | |
ACE_Reactor_Mask | ||||
) | [virtual] |
Definition at line 186 of file UIPMC_Mcast_Connection_Handler.cpp.
00188 { 00189 // No asserts here since the handler is registered with the Reactor 00190 // and the handler ownership is given to the Reactor. When the 00191 // Reactor closes, it will call handle_close() on the handler. It 00192 // is however important to overwrite handle_close() to do nothing 00193 // since the base class does too much. 00194 return 0; 00195 }
int TAO_UIPMC_Mcast_Connection_Handler::handle_input | ( | ACE_HANDLE | ) | [virtual] |
Implements TAO_Connection_Handler.
Definition at line 142 of file UIPMC_Mcast_Connection_Handler.cpp.
References TAO_Connection_Handler::handle_input_eh().
00143 { 00144 return this->handle_input_eh (h, this); 00145 }
int TAO_UIPMC_Mcast_Connection_Handler::handle_output | ( | ACE_HANDLE | ) | [virtual] |
Definition at line 148 of file UIPMC_Mcast_Connection_Handler.cpp.
References close_connection(), and TAO_Connection_Handler::handle_output_eh().
00149 { 00150 int result = 00151 this->handle_output_eh (handle, this); 00152 00153 if (result == -1) 00154 { 00155 this->close_connection (); 00156 return 0; 00157 } 00158 00159 return result; 00160 }
int TAO_UIPMC_Mcast_Connection_Handler::handle_timeout | ( | const ACE_Time_Value & | current_time, | |
const void * | act = 0 | |||
) | [virtual] |
Definition at line 163 of file UIPMC_Mcast_Connection_Handler.cpp.
References close(), TAO_LF_Event::LFS_TIMEOUT, and TAO_LF_Event::reset_state().
00165 { 00166 // Using this to ensure this instance will be deleted (if necessary) 00167 // only after reset_state(). Without this, when this refcount==1 - 00168 // the call to close() will cause a call to remove_reference() which 00169 // will delete this. At that point this->reset_state() is in no 00170 // man's territory and that causes SEGV on some platforms (Windows!) 00171 00172 TAO_Auto_Reference<TAO_UIPMC_Mcast_Connection_Handler> safeguard (*this); 00173 00174 // NOTE: Perhaps not the best solution, as it feels like the upper 00175 // layers should be responsible for this? 00176 00177 // We don't use this upcall for I/O. This is only used by the 00178 // Connector to indicate that the connection timedout. Therefore, 00179 // we should call close(). 00180 int ret = this->close (); 00181 this->reset_state (TAO_LF_Event::LFS_TIMEOUT); 00182 return ret; 00183 }
void TAO_UIPMC_Mcast_Connection_Handler::local_addr | ( | const ACE_INET_Addr & | addr | ) |
Definition at line 88 of file UIPMC_Mcast_Connection_Handler.cpp.
References addr(), and local_addr_.
00089 { 00090 local_addr_ = addr; 00091 }
const ACE_INET_Addr & TAO_UIPMC_Mcast_Connection_Handler::local_addr | ( | void | ) |
Definition at line 82 of file UIPMC_Mcast_Connection_Handler.cpp.
References local_addr_.
Referenced by TAO_UIPMC_Acceptor::open_i().
00083 { 00084 return local_addr_; 00085 }
int TAO_UIPMC_Mcast_Connection_Handler::open | ( | void * | ) | [virtual] |
Definition at line 110 of file UIPMC_Mcast_Connection_Handler.cpp.
References ACE_DEBUG, ACE_TEXT(), ACE_INET_Addr::get_port_number(), TAO_Transport::id(), LM_DEBUG, local_addr_, TAO_debug_level, and TAO_Connection_Handler::transport().
Referenced by open_handler(), and TAO_UIPMC_Acceptor::open_i().
00111 { 00112 this->peer ().join (this->local_addr_); 00113 00114 if (TAO_debug_level > 5) 00115 { 00116 ACE_DEBUG ((LM_DEBUG, 00117 ACE_TEXT("TAO (%P|%t) - UIPMC_Mcast_Connection_Handler::open_server, ") 00118 ACE_TEXT("subcribed to multicast group at %s:%d\n"), 00119 this->local_addr_.get_host_addr (), 00120 this->local_addr_.get_port_number () 00121 )); 00122 } 00123 00124 this->transport ()->id ((size_t) this->peer ().get_handle ()); 00125 00126 return 0; 00127 }
int TAO_UIPMC_Mcast_Connection_Handler::open_handler | ( | void * | v | ) | [virtual] |
Implements TAO_Connection_Handler.
Definition at line 104 of file UIPMC_Mcast_Connection_Handler.cpp.
References open().
00105 { 00106 return this->open (v); 00107 }
int TAO_UIPMC_Mcast_Connection_Handler::release_os_resources | ( | void | ) | [protected, virtual] |
Reimplemented from TAO_Connection_Handler.
Definition at line 204 of file UIPMC_Mcast_Connection_Handler.cpp.
Referenced by ~TAO_UIPMC_Mcast_Connection_Handler().
int TAO_UIPMC_Mcast_Connection_Handler::resume_handler | ( | void | ) | [virtual] |
Definition at line 130 of file UIPMC_Mcast_Connection_Handler.cpp.
References ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER.
00131 { 00132 return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER; 00133 }
ssize_t TAO_UIPMC_Mcast_Connection_Handler::send | ( | const iovec | iov[], | |
int | n, | |||
const ACE_Addr & | addr, | |||
int | flags = 0 | |||
) | const |
This is only to be able to use client and server connection handlers in the same way in transport.
Definition at line 94 of file UIPMC_Mcast_Connection_Handler.cpp.
References ACE_ASSERT.
00098 { 00099 ACE_ASSERT (0); 00100 return -1; 00101 }
Definition at line 121 of file UIPMC_Mcast_Connection_Handler.h.
Referenced by local_addr(), and open().