Merge pull request #2218 from jwillemsen/jwi-pthreadsigmask
[ACE_TAO.git] / TAO / tao / Strategies / COIOP_Connection_Handler.cpp
blob07527f887780fab05f47ae64d6b56cf6fa4dee3c
1 #include "tao/Strategies/COIOP_Connection_Handler.h"
3 #if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0)
5 #include "tao/Timeprobe.h"
6 #include "tao/debug.h"
7 #include "tao/ORB_Core.h"
8 #include "tao/ORB.h"
9 #include "tao/CDR.h"
10 #include "tao/Server_Strategy_Factory.h"
11 #include "tao/Transport_Cache_Manager.h"
12 #include "tao/Thread_Lane_Resources.h"
13 #include "tao/Base_Transport_Property.h"
14 #include "tao/Protocols_Hooks.h"
15 #include "tao/Resume_Handle.h"
17 #include "tao/Strategies/COIOP_Transport.h"
18 #include "tao/Strategies/COIOP_Endpoint.h"
20 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
22 TAO_COIOP_Connection_Handler::TAO_COIOP_Connection_Handler (ACE_Thread_Manager *t)
23 : TAO_COIOP_SVC_HANDLER (t, 0 , 0),
24 TAO_Connection_Handler (0)
26 // This constructor should *never* get called, it is just here to
27 // make the compiler happy: the default implementation of the
28 // Creation_Strategy requires a constructor with that signature, we
29 // don't use that implementation, but some (most?) compilers
30 // instantiate it anyway.
31 ACE_ASSERT (0);
35 TAO_COIOP_Connection_Handler::TAO_COIOP_Connection_Handler (TAO_ORB_Core *orb_core)
36 : TAO_COIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
37 TAO_Connection_Handler (orb_core)
39 TAO_COIOP_Transport* specific_transport = 0;
40 ACE_NEW (specific_transport,
41 TAO_COIOP_Transport(this, orb_core));
43 // store this pointer (indirectly increment ref count)
44 this->transport (specific_transport);
48 TAO_COIOP_Connection_Handler::~TAO_COIOP_Connection_Handler ()
50 delete this->transport ();
52 int const result =
53 this->release_os_resources ();
55 if (result == -1 && TAO_debug_level)
57 TAOLIB_ERROR ((LM_ERROR,
58 ACE_TEXT("TAO (%P|%t) - COIOP_Connection_Handler::")
59 ACE_TEXT("~COIOP_Connection_Handler, ")
60 ACE_TEXT("release_os_resources() failed %m\n")));
62 delete this->transport ();
65 int
66 TAO_COIOP_Connection_Handler::open_handler (void *v)
68 return this->open (v);
71 int
72 TAO_COIOP_Connection_Handler::open (void*)
74 return 0;
77 int
78 TAO_COIOP_Connection_Handler::resume_handler ()
80 return ACE_Event_Handler::ACE_APPLICATION_RESUMES_HANDLER;
83 int
84 TAO_COIOP_Connection_Handler::close_connection ()
86 return this->close_connection_eh (this);
89 int
90 TAO_COIOP_Connection_Handler::handle_input (ACE_HANDLE h)
92 return this->handle_input_eh (h, this);
95 int
96 TAO_COIOP_Connection_Handler::handle_output (ACE_HANDLE handle)
98 int const result =
99 this->handle_output_eh (handle, this);
101 if (result == -1)
103 this->close_connection ();
104 return 0;
107 return result;
111 TAO_COIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
112 const void *)
114 // We don't use this upcall from the Reactor. However, we should
115 // override this since the base class returns -1 which will result
116 // in handle_close() getting called.
117 return 0;
121 TAO_COIOP_Connection_Handler::handle_close (ACE_HANDLE,
122 ACE_Reactor_Mask)
124 // No asserts here since the handler is registered with the Reactor
125 // and the handler ownership is given to the Reactor. When the
126 // Reactor closes, it will call handle_close() on the handler. It
127 // is however important to overwrite handle_close() to do nothing
128 // since the base class does too much.
129 return 0;
133 TAO_COIOP_Connection_Handler::close (u_long flags)
135 return this->close_handler (flags);
138 TAO_END_VERSIONED_NAMESPACE_DECL
140 #endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */