| 423 | } |
| 424 | |
| 425 | int 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 | } |
nothing calls this directly
no test coverage detected