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

Method SendData

adapter/micro_thread/mt_net.cpp:1082–1115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1080}
1081
1082int32_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
1117int32_t CSockLink::RecvDispath()
1118{

Callers 2

mt_multi_sendtoMethod · 0.45
WaitSendMethod · 0.45

Calls 5

mt_time_msFunction · 0.85
EnableOutputMethod · 0.80
KqueueCtrlAddMethod · 0.80
DisableOutputMethod · 0.80
KqueueCtrlDelMethod · 0.80

Tested by

no test coverage detected