]>
Commit | Line | Data |
---|---|---|
1ea345ac JB |
1 | --- qpidc-0.16/src/qpid/cluster/Cpg.cpp.orig 2010-02-26 17:47:23.000000000 +0100 |
2 | +++ qpidc-0.16/src/qpid/cluster/Cpg.cpp 2020-12-13 07:18:53.042400272 +0100 | |
3 | @@ -32,7 +32,7 @@ | |
4 | // This is a macro instead of a function because we don't want to | |
5 | // evaluate the MSG argument unless there is an error. | |
6 | #define CPG_CHECK(RESULT, MSG) \ | |
7 | - if ((RESULT) != CPG_OK) throw Exception(errorStr((RESULT), (MSG))) | |
8 | + if ((RESULT) != CS_OK) throw Exception(errorStr((RESULT), (MSG))) | |
9 | ||
10 | namespace qpid { | |
11 | namespace cluster { | |
12 | @@ -50,13 +50,13 @@ | |
13 | ||
14 | // Applies the same retry-logic to all cpg calls that need it. | |
15 | void Cpg::callCpg ( CpgOp & c ) { | |
16 | - cpg_error_t result; | |
17 | + cs_error_t result; | |
18 | unsigned int snooze = 10; | |
19 | for ( unsigned int nth_try = 0; nth_try < cpgRetries; ++ nth_try ) { | |
20 | - if ( CPG_OK == (result = c.op(handle, & group))) { | |
21 | + if ( CS_OK == (result = c.op(handle, & group))) { | |
22 | break; | |
23 | } | |
24 | - else if ( result == CPG_ERR_TRY_AGAIN ) { | |
25 | + else if ( result == CS_ERR_TRY_AGAIN ) { | |
26 | QPID_LOG(info, "Retrying " << c.opName ); | |
27 | sys::usleep ( snooze ); | |
28 | snooze *= 10; | |
29 | @@ -65,7 +65,7 @@ | |
30 | else break; // Don't retry unless CPG tells us to. | |
31 | } | |
32 | ||
33 | - if ( result != CPG_OK ) | |
34 | + if ( result != CS_OK ) | |
35 | CPG_CHECK(result, c.msg(group)); | |
36 | } | |
37 | ||
38 | @@ -127,9 +127,9 @@ | |
39 | callbacks.cpg_confchg_fn = &globalConfigChange; | |
40 | ||
41 | QPID_LOG(notice, "Initializing CPG"); | |
42 | - cpg_error_t err = cpg_initialize(&handle, &callbacks); | |
43 | + cs_error_t err = cpg_initialize(&handle, &callbacks); | |
44 | int retries = 6; // FIXME aconway 2009-08-06: make this configurable. | |
45 | - while (err == CPG_ERR_TRY_AGAIN && --retries) { | |
46 | + while (err == CS_ERR_TRY_AGAIN && --retries) { | |
47 | QPID_LOG(notice, "Re-trying CPG initialization."); | |
48 | sys::sleep(5); | |
49 | err = cpg_initialize(&handle, &callbacks); | |
50 | @@ -169,11 +169,11 @@ | |
51 | if (flowState == CPG_FLOW_CONTROL_ENABLED) | |
52 | return false; | |
53 | ||
54 | - cpg_error_t result; | |
55 | + cs_error_t result; | |
56 | do { | |
57 | result = cpg_mcast_joined(handle, CPG_TYPE_AGREED, const_cast<iovec*>(iov), iovLen); | |
58 | - if (result != CPG_ERR_TRY_AGAIN) CPG_CHECK(result, cantMcastMsg(group)); | |
59 | - } while(result == CPG_ERR_TRY_AGAIN); | |
60 | + if (result != CS_ERR_TRY_AGAIN) CPG_CHECK(result, cantMcastMsg(group)); | |
61 | + } while(result == CS_ERR_TRY_AGAIN); | |
62 | return true; | |
63 | } | |
64 | ||
65 | @@ -187,34 +187,34 @@ | |
66 | } | |
67 | ||
68 | void Cpg::dispatchOne() { | |
69 | - CPG_CHECK(cpg_dispatch(handle,CPG_DISPATCH_ONE), "Error in CPG dispatch"); | |
70 | + CPG_CHECK(cpg_dispatch(handle,CS_DISPATCH_ONE), "Error in CPG dispatch"); | |
71 | } | |
72 | ||
73 | void Cpg::dispatchAll() { | |
74 | - CPG_CHECK(cpg_dispatch(handle,CPG_DISPATCH_ALL), "Error in CPG dispatch"); | |
75 | + CPG_CHECK(cpg_dispatch(handle,CS_DISPATCH_ALL), "Error in CPG dispatch"); | |
76 | } | |
77 | ||
78 | void Cpg::dispatchBlocking() { | |
79 | - CPG_CHECK(cpg_dispatch(handle,CPG_DISPATCH_BLOCKING), "Error in CPG dispatch"); | |
80 | + CPG_CHECK(cpg_dispatch(handle,CS_DISPATCH_BLOCKING), "Error in CPG dispatch"); | |
81 | } | |
82 | ||
83 | -string Cpg::errorStr(cpg_error_t err, const std::string& msg) { | |
84 | +string Cpg::errorStr(cs_error_t err, const std::string& msg) { | |
85 | std::ostringstream os; | |
86 | os << msg << ": "; | |
87 | switch (err) { | |
88 | - case CPG_OK: os << "ok"; break; | |
89 | - case CPG_ERR_LIBRARY: os << "library"; break; | |
90 | - case CPG_ERR_TIMEOUT: os << "timeout"; break; | |
91 | - case CPG_ERR_TRY_AGAIN: os << "try again"; break; | |
92 | - case CPG_ERR_INVALID_PARAM: os << "invalid param"; break; | |
93 | - case CPG_ERR_NO_MEMORY: os << "no memory"; break; | |
94 | - case CPG_ERR_BAD_HANDLE: os << "bad handle"; break; | |
95 | - case CPG_ERR_ACCESS: os << "access denied. You may need to set your group ID to 'ais'"; break; | |
96 | - case CPG_ERR_NOT_EXIST: os << "not exist"; break; | |
97 | - case CPG_ERR_EXIST: os << "exist"; break; | |
98 | - case CPG_ERR_NOT_SUPPORTED: os << "not supported"; break; | |
99 | - case CPG_ERR_SECURITY: os << "security"; break; | |
100 | - case CPG_ERR_TOO_MANY_GROUPS: os << "too many groups"; break; | |
101 | + case CS_OK: os << "ok"; break; | |
102 | + case CS_ERR_LIBRARY: os << "library"; break; | |
103 | + case CS_ERR_TIMEOUT: os << "timeout"; break; | |
104 | + case CS_ERR_TRY_AGAIN: os << "try again"; break; | |
105 | + case CS_ERR_INVALID_PARAM: os << "invalid param"; break; | |
106 | + case CS_ERR_NO_MEMORY: os << "no memory"; break; | |
107 | + case CS_ERR_BAD_HANDLE: os << "bad handle"; break; | |
108 | + case CS_ERR_ACCESS: os << "access denied. You may need to set your group ID to 'ais'"; break; | |
109 | + case CS_ERR_NOT_EXIST: os << "not exist"; break; | |
110 | + case CS_ERR_EXIST: os << "exist"; break; | |
111 | + case CS_ERR_NOT_SUPPORTED: os << "not supported"; break; | |
112 | + case CS_ERR_SECURITY: os << "security"; break; | |
113 | + case CS_ERR_TOO_MANY_GROUPS: os << "too many groups"; break; | |
114 | default: os << ": unknown cpg error " << err; | |
115 | }; | |
116 | os << " (" << err << ")"; | |
117 | --- qpidc-0.16/src/qpid/cluster/Cpg.h.orig 2009-12-11 16:29:00.000000000 +0100 | |
118 | +++ qpidc-0.16/src/qpid/cluster/Cpg.h 2020-12-13 06:57:45.132602462 +0100 | |
119 | @@ -131,7 +131,7 @@ | |
120 | CpgOp ( std::string opName ) | |
121 | : opName(opName) { } | |
122 | ||
123 | - virtual cpg_error_t op ( cpg_handle_t handle, struct cpg_name * ) = 0; | |
124 | + virtual cs_error_t op ( cpg_handle_t handle, struct cpg_name * ) = 0; | |
125 | virtual std::string msg(const Name&) = 0; | |
126 | virtual ~CpgOp ( ) { } | |
127 | }; | |
128 | @@ -141,7 +141,7 @@ | |
129 | CpgJoinOp ( ) | |
130 | : CpgOp ( std::string("cpg_join") ) { } | |
131 | ||
132 | - cpg_error_t op(cpg_handle_t handle, struct cpg_name * group) { | |
133 | + cs_error_t op(cpg_handle_t handle, struct cpg_name * group) { | |
134 | return cpg_join ( handle, group ); | |
135 | } | |
136 | ||
137 | @@ -152,7 +152,7 @@ | |
138 | CpgLeaveOp ( ) | |
139 | : CpgOp ( std::string("cpg_leave") ) { } | |
140 | ||
141 | - cpg_error_t op(cpg_handle_t handle, struct cpg_name * group) { | |
142 | + cs_error_t op(cpg_handle_t handle, struct cpg_name * group) { | |
143 | return cpg_leave ( handle, group ); | |
144 | } | |
145 | ||
146 | @@ -163,7 +163,7 @@ | |
147 | CpgFinalizeOp ( ) | |
148 | : CpgOp ( std::string("cpg_finalize") ) { } | |
149 | ||
150 | - cpg_error_t op(cpg_handle_t handle, struct cpg_name *) { | |
151 | + cs_error_t op(cpg_handle_t handle, struct cpg_name *) { | |
152 | return cpg_finalize ( handle ); | |
153 | } | |
154 | ||
155 | @@ -177,7 +177,7 @@ | |
156 | CpgLeaveOp cpgLeaveOp; | |
157 | CpgFinalizeOp cpgFinalizeOp; | |
158 | ||
159 | - static std::string errorStr(cpg_error_t err, const std::string& msg); | |
160 | + static std::string errorStr(cs_error_t err, const std::string& msg); | |
161 | static std::string cantJoinMsg(const Name&); | |
162 | static std::string cantLeaveMsg(const Name&); | |
163 | static std::string cantMcastMsg(const Name&); |