| 222 | } |
| 223 | |
| 224 | void LearnerSender :: SendLearnedValue(const uint64_t llBeginInstanceID, const nodeid_t iSendToNodeID) |
| 225 | { |
| 226 | PLGHead("BeginInstanceID %lu SendToNodeID %lu", llBeginInstanceID, iSendToNodeID); |
| 227 | |
| 228 | uint64_t llSendInstanceID = llBeginInstanceID; |
| 229 | int ret = 0; |
| 230 | |
| 231 | uint32_t iLastChecksum = 0; |
| 232 | |
| 233 | //control send speed to avoid affecting the network too much. |
| 234 | int iSendQps = LearnerSender_SEND_QPS; |
| 235 | int iSleepMs = iSendQps > 1000 ? 1 : 1000 / iSendQps; |
| 236 | int iSendInterval = iSendQps > 1000 ? iSendQps / 1000 + 1 : 1; |
| 237 | |
| 238 | PLGDebug("SendQps %d SleepMs %d SendInterval %d AckLead %d", |
| 239 | iSendQps, iSleepMs, iSendInterval, m_iAckLead); |
| 240 | |
| 241 | int iSendCount = 0; |
| 242 | while (llSendInstanceID < m_poLearner->GetInstanceID()) |
| 243 | { |
| 244 | ret = SendOne(llSendInstanceID, iSendToNodeID, iLastChecksum); |
| 245 | if (ret != 0) |
| 246 | { |
| 247 | PLGErr("SendOne fail, SendInstanceID %lu SendToNodeID %lu ret %d", |
| 248 | llSendInstanceID, iSendToNodeID, ret); |
| 249 | return; |
| 250 | } |
| 251 | |
| 252 | if (!CheckAck(llSendInstanceID)) |
| 253 | { |
| 254 | return; |
| 255 | } |
| 256 | |
| 257 | iSendCount++; |
| 258 | llSendInstanceID++; |
| 259 | ReleshSending(); |
| 260 | |
| 261 | if (iSendCount >= iSendInterval) |
| 262 | { |
| 263 | iSendCount = 0; |
| 264 | Time::MsSleep(iSleepMs); |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | //succ send, reset ack lead. |
| 269 | m_iAckLead = LearnerSender_ACK_LEAD; |
| 270 | PLGImp("SendDone, SendEndInstanceID %lu", llSendInstanceID); |
| 271 | } |
| 272 | |
| 273 | int LearnerSender :: SendOne(const uint64_t llSendInstanceID, const nodeid_t iSendToNodeID, uint32_t & iLastChecksum) |
| 274 | { |
nothing calls this directly
no outgoing calls
no test coverage detected