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

Method WaitRecv

adapter/micro_thread/mt_net.cpp:370–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370int32_t CNetHandler::WaitRecv(uint64_t timeout)
371{
372 CSockLink* conn = (CSockLink*)this->_conn_ptr;
373 if (NULL == conn)
374 {
375 MTLOG_ERROR("get sock link handle failed");
376 return RC_MEM_ERROR;
377 }
378
379 if (_conn_type == TYPE_CONN_SENDONLY)
380 {
381 MTLOG_DEBUG("only send, without recv");
382 return 0;
383 }
384
385 this->SwitchToRecv();
386
387 MtFrame* mtframe = MtFrame::Instance();
388 mtframe->WaitNotify(timeout);
389
390 this->SwitchToIdle();
391
392 if ((_rsp_buff != NULL) && (_rsp_buff->data_len > 0))
393 {
394 MTLOG_DEBUG("recv get rsp, len %d", _rsp_buff->data_len);
395 return 0;
396 }
397 else
398 {
399 MTLOG_TRACE("recv get out errno %d", _err_no);
400 return RC_RECV_FAIL;
401 }
402}
403
404int32_t CNetHandler::SendRecv(void* data, uint32_t len, uint32_t timeout)
405{

Callers 1

SendRecvMethod · 0.95

Calls 3

SwitchToRecvMethod · 0.95
SwitchToIdleMethod · 0.95
WaitNotifyMethod · 0.80

Tested by

no test coverage detected