| 368 | } |
| 369 | |
| 370 | int32_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 | |
| 404 | int32_t CNetHandler::SendRecv(void* data, uint32_t len, uint32_t timeout) |
| 405 | { |
no test coverage detected