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

Method SendData

adapter/micro_thread/mt_connection.cpp:115–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115int 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
145int UdpShortConn::RecvData()
146{

Callers

nothing calls this directly

Calls 8

GetMsgBuffMethod · 0.80
GetMsgLenMethod · 0.80
GetMsgDstAddrMethod · 0.80
SetHaveSndLenMethod · 0.80
GetHaveSndLenMethod · 0.80
GetOsfdMethod · 0.80
ff_hook_sendtoFunction · 0.70
ff_hook_sendFunction · 0.70

Tested by

no test coverage detected