blob: 0597f99e5827eafc9e2dcdd780241a124f3403cd (
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
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
|
#include "LF_CH_Event.h"
#include "ace/Log_Msg.h"
#if !defined (__ACE_INLINE__)
# include "LF_CH_Event.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID(tao,
LF_Invocation_Event,
"$Id$")
TAO_LF_CH_Event::TAO_LF_CH_Event (void)
: TAO_LF_Event (),
prev_state_ (TAO_LF_Event::LFS_IDLE)
{
}
TAO_LF_CH_Event::~TAO_LF_CH_Event (void)
{
}
void
TAO_LF_CH_Event::state_changed_i (int new_state)
{
if (this->state_ == new_state)
return;
// Validate the state change
if (this->state_ == TAO_LF_Event::LFS_IDLE)
{
// From the LFS_IDLE state we can only become active.
if (new_state == TAO_LF_Event::LFS_CONNECTION_WAIT)
{
this->prev_state_ = this->state_;
this->state_ = new_state;
}
return;
}
else if (this->state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
{
// Only a few states are possible from CONNECTION_WAIT states
if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED
|| new_state == TAO_LF_Event::LFS_SUCCESS)
{
this->prev_state_ = this->state_;
this->state_ = new_state;
}
return;
}
else if (this->state_ == TAO_LF_Event::LFS_SUCCESS)
{
if (new_state == TAO_LF_Event::LFS_CONNECTION_CLOSED)
{
this->prev_state_ = this->state_;
this->state_ = new_state;
}
return;
}
return;
}
int
TAO_LF_CH_Event::successful (void) const
{
if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
return this->state_ == TAO_LF_Event::LFS_SUCCESS;
else if (this->prev_state_ == TAO_LF_Event::LFS_SUCCESS)
return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
return 0;
}
int
TAO_LF_CH_Event::error_detected (void) const
{
if (this->prev_state_ == TAO_LF_Event::LFS_CONNECTION_WAIT)
return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
else if (this->prev_state_ == TAO_LF_Event::LFS_SUCCESS)
return (this->state_ != TAO_LF_Event::LFS_CONNECTION_CLOSED);
return 0;
}
void
TAO_LF_CH_Event::set_state (int new_state)
{
this->prev_state_ = this->state_;
this->state_ = new_state;
}
int
TAO_LF_CH_Event::is_state_final (void)
{
return this->state_ == TAO_LF_Event::LFS_CONNECTION_CLOSED;
}
|