MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / processTimeout

Method processTimeout

libapp2sys/src/main/cpp/udp.h:217–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215 }
216
217 int processTimeout(TimeoutEvent *timeoutEvent) {
218 const int64_t iSender = sockaddrToint64(timeoutEvent->toaddr);
219 Sender *const ss = m_mapSender.count(iSender) ? m_mapSender[iSender] : NULL;
220
221 const std::string strAddr = sockaddrToString(timeoutEvent->toaddr);
222 if (!ss) {
223 perr("Invalid socket. Not in the list.strAddr:%s ", strAddr.c_str());
224 return -1;
225 }
226
227 if (timeoutEvent->udpPkg->type == PACKAGE_SYN && timeoutEvent != &ss->synTimeoutEvent) {
228 perr("timeoutEvent:%s != &ss->synTimeoutEvent:%s", timeoutEvent->toString().c_str(), ss->synTimeoutEvent.toString().c_str());
229 return -1;
230 }
231 if (timeoutEvent->udpPkg->type == PACKAGE_FIN && timeoutEvent != &ss->finTimeoutEvent) {
232 perr("timeoutEvent:%s != &ss->finTimeoutEvent:%s", timeoutEvent->toString().c_str(), ss->finTimeoutEvent.toString().c_str());
233 return -1;
234 }
235 if (timeoutEvent->udpPkg->type == PACKAGE_DATA) {
236 TimeoutEvent *tv = getWindowBySeq(ss->dataWindow, timeoutEvent->udpPkg->seq);
237 if (timeoutEvent != tv) {
238 perr("TIME_Win_not_found %s %s win:%s", timeoutEvent->toString().c_str(), ss->toString().c_str(),
239 getWindowSeqList(ss->dataWindow).c_str());
240 return -1;
241 }
242 }
243
244 pwrn("TIMEOUT: %s %s", timeoutEvent->toString().c_str(), timeoutEvent->tryCount >= CONST_MAXRETRANS ? "!MAXRETRANS!" : "");
245 if (timeoutEvent->tryCount >= CONST_MAXRETRANS) {
246 recvEvent(EVENT_TIMEOUT, &timeoutEvent->toaddr, timeoutEvent->udpPkg->sessionid, NULL, 0);
247 return 0;
248 }
249 timeoutEvent->tryCount++;
250 return sendPackage(&timeoutEvent->toaddr, timeoutEvent->udpPkg->type, timeoutEvent->udpPkg->seq, timeoutEvent->udpPkg);
251 }
252
253 int cleanReceiver(Receiver *rs) {
254 if (!rs) {

Callers

nothing calls this directly

Calls 4

sockaddrToint64Function · 0.85
sockaddrToStringFunction · 0.85
countMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected