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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#include "Notify_Handler.h"
#include "Connection_Handler.h"
#include "Transport.h"
#include "ORB_Core.h"
#include "ace/Malloc_T.h"
#include "Resume_Handle.h"
ACE_RCSID (tao,
Notify_Handler,
"$Id$")
TAO_Notify_Handler::TAO_Notify_Handler (TAO_Transport *t,
ACE_HANDLE h,
ACE_Allocator *alloc)
: ACE_Event_Handler (t->orb_core ()->reactor ()),
// REFCNT: Matches with Notify_Handler::~Notify_Handler()
t_ (TAO_Transport::_duplicate (t)),
h_ (h),
allocator_ (alloc)
{
}
TAO_Notify_Handler::TAO_Notify_Handler (TAO_Connection_Handler *ch,
ACE_Allocator *alloc)
: ACE_Event_Handler (ch->transport ()->orb_core ()->reactor ()),
// REFCNT: Matches with Notify_Handler::~Notify_Handler()
t_ (ch->transport ()),
h_ (ACE_INVALID_HANDLE),
allocator_ (alloc)
{
// This constructor should *never* get called, it is just here to
// for backward comptibility.
ACE_ASSERT (ch == 0);
}
TAO_Notify_Handler::~TAO_Notify_Handler (void)
{
TAO_Transport::release (this->t_);
}
/*static*/ TAO_Notify_Handler *
TAO_Notify_Handler::create_handler (TAO_Connection_Handler *,
ACE_Allocator *)
{
return 0;
}
/*static*/ TAO_Notify_Handler *
TAO_Notify_Handler::create_handler (TAO_Transport *t,
ACE_HANDLE h,
ACE_Allocator *alloc)
{
TAO_Notify_Handler *nh = 0;
if (alloc)
{
ACE_NEW_MALLOC_RETURN (nh,
ACE_static_cast (
TAO_Notify_Handler *,
alloc->malloc (sizeof (TAO_Notify_Handler))),
TAO_Notify_Handler (t,
h,
alloc),
0);
return nh;
}
return 0;
}
/*static*/ void
TAO_Notify_Handler::destroy_handler (TAO_Notify_Handler *nh)
{
if (nh->allocator_)
{
ACE_DES_FREE (nh,
nh->allocator_->free,
TAO_Notify_Handler);
}
return;
}
int
TAO_Notify_Handler::handle_input (ACE_HANDLE)
{
// NOTE: We will do what the Connection_Handler will do with some
// exceptions though.. Quite a few things done are not required
// by the Notify_Handler at all.
// Let the transport know that it is used
(void) this->t_->update_transport ();
TAO_Resume_Handle resume_handle (this->t_->orb_core (),
this->h_);
// Does return value matter? Not is my opinion.
(void) this->t_->handle_input_i (resume_handle);
// Yes, we are wantedly returning this so that handle_close () would
// be called
return -1;
}
int
TAO_Notify_Handler::handle_close (ACE_HANDLE /*fd*/,
ACE_Reactor_Mask /*close_mask*/)
{
TAO_Notify_Handler::destroy_handler (this);
return 0;
}
|