blob: 26d418b3db1fcd4b036ec61c79a0b0d955e5bae7 (
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
|
// author : Boris Kolpackov <boris@kolpackov.net>
#ifndef ACE_RMCAST_RETRANSMIT_H
#define ACE_RMCAST_RETRANSMIT_H
#include "ace/Hash_Map_Manager.h"
#include "ace/Thread_Manager.h"
#include "Stack.h"
#include "Protocol.h"
#include "Bits.h"
#include "Parameters.h"
namespace ACE_RMCast
{
class Retransmit : public Element
{
public:
Retransmit (Parameters const& params);
virtual void
out_start (Out_Element* out);
virtual void
out_stop ();
public:
virtual void
send (Message_ptr m);
virtual void
recv (Message_ptr m);
private:
struct Descr
{
// Shouldn't be available but ACE_Hash_Map needs it.
//
Descr ()
: msg_ (), count_ (0)
{
}
Descr (Message_ptr msg)
: msg_ (msg), count_ (0)
{
}
unsigned long
inc ()
{
return ++count_;
}
void
reset ()
{
count_ = 0;
}
Message_ptr
message () const
{
return msg_->clone ();
}
private:
Message_ptr msg_;
unsigned long count_;
};
typedef
ACE_Hash_Map_Manager<u64, Descr, ACE_Null_Mutex>
Queue;
private:
void
track ();
static ACE_THR_FUNC_RETURN
track_thunk (void* obj);
private:
Parameters const& params_;
Queue queue_;
Mutex mutex_;
Condition cond_;
bool stop_;
ACE_Thread_Manager tracker_mgr_;
};
}
#endif // ACE_RMCAST_RETRANSMIT_H
|