MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mt_msg_sendrcv

Method mt_msg_sendrcv

adapter/micro_thread/mt_concurrent.cpp:425–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425int NS_MICRO_THREAD::mt_msg_sendrcv(IMtActList& req_list, int timeout)
426{
427 int iRet = 0;
428
429 for (IMtActList::iterator it = req_list.begin(); it != req_list.end(); ++it)
430 {
431 IMtAction* pAction = *it;
432 if (!pAction || pAction->InitConnEnv() < 0)
433 {
434 MTLOG_ERROR("invalid action(%p) or int failed, error", pAction);
435 return -1;
436 }
437
438 iRet = pAction->DoEncode();
439 if (iRet < 0)
440 {
441 pAction->SetErrno(ERR_ENCODE_ERROR);
442 MTLOG_ERROR("pack action pkg failed, act %p, ret %d", pAction, iRet);
443 continue;
444 }
445
446 }
447
448 mt_multi_sendrcv_ex(req_list, timeout);
449
450 for (IMtActList::iterator it = req_list.begin(); it != req_list.end(); ++it)
451 {
452 IMtAction* pAction = *it;
453
454 if (pAction->GetMsgFlag() != MULTI_FLAG_FIN)
455 {
456 pAction->DoError();
457 MTLOG_DEBUG("send recv failed: %d", pAction->GetErrno());
458 continue;
459 }
460
461 iRet = pAction->DoProcess();
462 if (iRet < 0)
463 {
464 MTLOG_DEBUG("action process failed: %d", iRet);
465 continue;
466 }
467 }
468
469 for (IMtActList::iterator it = req_list.begin(); it != req_list.end(); ++it)
470 {
471 IMtAction* pAction = *it;
472 pAction->Reset();
473 }
474
475 return 0;
476}

Callers

nothing calls this directly

Calls 8

InitConnEnvMethod · 0.80
DoEncodeMethod · 0.80
SetErrnoMethod · 0.80
GetMsgFlagMethod · 0.80
DoErrorMethod · 0.80
GetErrnoMethod · 0.80
DoProcessMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected