| 1080 | } |
| 1081 | |
| 1082 | int32_t CSockLink::SendData(void* data, uint32_t len) |
| 1083 | { |
| 1084 | int32_t ret = 0; |
| 1085 | bool rc = false; |
| 1086 | |
| 1087 | this->_last_access = mt_time_ms(); |
| 1088 | |
| 1089 | if (_proto_type == NET_PROTO_UDP) |
| 1090 | { |
| 1091 | ret = SendCacheUdp(data, len); |
| 1092 | } |
| 1093 | else |
| 1094 | { |
| 1095 | ret = SendCacheTcp(data, len); |
| 1096 | } |
| 1097 | |
| 1098 | if (ret < (int32_t)len) |
| 1099 | { |
| 1100 | this->EnableOutput(); |
| 1101 | rc = MtFrame::Instance()->KqueueCtrlAdd(_fd, KQ_EVENT_READ); |
| 1102 | } |
| 1103 | else |
| 1104 | { |
| 1105 | this->DisableOutput(); |
| 1106 | rc = MtFrame::Instance()->KqueueCtrlDel(_fd, KQ_EVENT_WRITE); |
| 1107 | } |
| 1108 | |
| 1109 | if (!rc) |
| 1110 | { |
| 1111 | MTLOG_ERROR("socket epoll mng failed[%m], wait timeout"); |
| 1112 | } |
| 1113 | |
| 1114 | return ret; |
| 1115 | } |
| 1116 | |
| 1117 | int32_t CSockLink::RecvDispath() |
| 1118 | { |
no test coverage detected