| 113 | } |
| 114 | |
| 115 | int UdpShortConn::SendData() |
| 116 | { |
| 117 | if (!_action || !_msg_buff) { |
| 118 | MTLOG_ERROR("conn not set action %p, or msg %p, error", _action, _msg_buff); |
| 119 | return -100; |
| 120 | } |
| 121 | |
| 122 | mt_hook_syscall(sendto); |
| 123 | int ret = ff_hook_sendto(_osfd, _msg_buff->GetMsgBuff(), _msg_buff->GetMsgLen(), 0, |
| 124 | (struct sockaddr*)_action->GetMsgDstAddr(), sizeof(struct sockaddr_in)); |
| 125 | if (ret == -1) |
| 126 | { |
| 127 | if ((errno == EINTR) || (errno == EAGAIN) || (errno == EINPROGRESS)) |
| 128 | { |
| 129 | return 0; |
| 130 | } |
| 131 | else |
| 132 | { |
| 133 | MTLOG_ERROR("socket send failed, fd %d, errno %d(%s)", _osfd, |
| 134 | errno, strerror(errno)); |
| 135 | return -2; |
| 136 | } |
| 137 | } |
| 138 | else |
| 139 | { |
| 140 | _msg_buff->SetHaveSndLen(ret); |
| 141 | return ret; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | int UdpShortConn::RecvData() |
| 146 | { |
nothing calls this directly
no test coverage detected