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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
//
// $Id$
//
#include "RMCast_Retransmission.h"
#include "RMCast_Proxy.h"
#include "RMCast_Ack_Worker.h"
#include "RMCast_Resend_Worker.h"
#include "ace/Message_Block.h"
#if !defined (__ACE_INLINE__)
# include "RMCast_Retransmission.i"
#endif /* ! __ACE_INLINE__ */
ACE_RCSID(ace, RMCast_Retransmission, "$Id$")
ACE_RMCast_Retransmission::~ACE_RMCast_Retransmission (void)
{
}
int
ACE_RMCast_Retransmission::resend (ACE_UINT32 max_sequence_number)
{
if (this->next () == 0)
return 0;
ACE_RMCast_Resend_Worker worker (this->next (), max_sequence_number);
if (this->messages_.for_each (&worker) == -1)
return -1;
return worker.n;
}
int
ACE_RMCast_Retransmission::resend_all (void)
{
if (this->next () == 0)
return 0;
ACE_RMCast_Resend_Worker worker (this->next (), ACE_UINT32_MAX);
if (this->messages_.for_each (&worker) == -1)
return -1;
return worker.n;
}
int
ACE_RMCast_Retransmission::has_data (void)
{
return !this->messages_.empty ();
}
int
ACE_RMCast_Retransmission::close (void)
{
// @@
return 0;
}
int
ACE_RMCast_Retransmission::data (ACE_RMCast::Data &data)
{
if (this->next () == 0)
return 0;
int r = this->next ()->data (data);
if (r == 0)
{
ACE_RMCast::Data copy = data;
copy.payload = ACE_Message_Block::duplicate (data.payload);
r = this->messages_.bind (data.sequence_number, copy);
}
return r;
}
int
ACE_RMCast_Retransmission::join (ACE_RMCast::Join &join)
{
if (join.source == 0)
return 0;
ACE_RMCast::Ack_Join ack_join;
ack_join.source = 0;
ack_join.next_sequence_number = this->messages_.first_key ();
(void) join.source->reply_ack_join (ack_join);
// @@ We should force a full retransmission of all the messages!
return 0;
}
int
ACE_RMCast_Retransmission::leave (ACE_RMCast::Leave &leave)
{
if (leave.source == 0)
return 0;
ACE_RMCast::Ack_Leave ack_leave;
ack_leave.source = 0;
(void) leave.source->reply_ack_leave (ack_leave);
return 0;
}
int
ACE_RMCast_Retransmission::ack (ACE_RMCast::Ack &ack)
{
Messages::Write_Guard ace_mon (this->messages_);
ACE_RMCast_Ack_Worker worker (ack, ace_mon, &this->messages_);
return this->messages_.for_each (&worker);
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_RB_Tree<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
template class ACE_RB_Tree_Iterator_Base<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
template class ACE_RB_Tree_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
template class ACE_RB_Tree_Reverse_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>;
template class ACE_RB_Tree_Node<ACE_UINT32,ACE_RMCast::Data>;
template class ACE_RMCast_Copy_On_Write<ACE_UINT32,ACE_RMCast::Data,ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
template class ACE_RMCast_Copy_On_Write_Container<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
template class ACE_RMCast_Copy_On_Write_Write_Guard<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
template class ACE_RMCast_Copy_On_Write_Read_Guard<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
template class ACE_RMCast_Copy_On_Write_Collection<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>;
template class ACE_RMCast_Worker<ACE_UINT32,ACE_RMCast::Data>;
#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_RB_Tree<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Iterator_Base<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Reverse_Iterator<ACE_UINT32,ACE_RMCast::Data,ACE_Less_Than<ACE_UINT32>,ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Node<ACE_UINT32,ACE_RMCast::Data>
#pragma instantiate ACE_RMCast_Copy_On_Write<ACE_UINT32,ACE_RMCast::Data,ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>
#pragma instantiate ACE_RMCast_Copy_On_Write_Container<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>
#pragma instantiate ACE_RMCast_Copy_On_Write_Write_Guard<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>
#pragma instantiate ACE_RMCast_Copy_On_Write_Read_Guard<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>
#pragma instantiate ACE_RMCast_Copy_On_Write_Collection<ACE_RMCast_Retransmission::Collection,ACE_RMCast_Retransmission::Collection_Iterator>
#pragma instantiate ACE_RMCast_Worker<ACE_UINT32,ACE_RMCast::Data>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
|