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

Method RecvData

adapter/micro_thread/mt_connection.cpp:145–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145int UdpShortConn::RecvData()
146{
147 if (!_action || !_msg_buff) {
148 MTLOG_ERROR("conn not set action %p, or msg %p, error", _action, _msg_buff);
149 return -100;
150 }
151
152 struct sockaddr_in from;
153 socklen_t fromlen = sizeof(from);
154 mt_hook_syscall(recvfrom);
155 int ret = ff_hook_recvfrom(_osfd, _msg_buff->GetMsgBuff(), _msg_buff->GetMaxLen(),
156 0, (struct sockaddr*)&from, &fromlen);
157 if (ret < 0)
158 {
159 if ((errno == EINTR) || (errno == EAGAIN) || (errno == EINPROGRESS))
160 {
161 return 0;
162 }
163 else
164 {
165 MTLOG_ERROR("socket recv failed, fd %d, errno %d(%s)", _osfd,
166 errno, strerror(errno));
167 return -2;
168 }
169 }
170 else if (ret == 0)
171 {
172 return -1;
173 }
174 else
175 {
176 _msg_buff->SetHaveRcvLen(ret);
177 }
178
179 ret = _action->DoInput();
180 if (ret > 0)
181 {
182 _msg_buff->SetMsgLen(ret);
183 return ret;
184 }
185 else if (ret == 0)
186 {
187 return 0;
188 }
189 else if (ret == -65535)
190 {
191 _msg_buff->SetHaveRcvLen(0);
192 return 0;
193 }
194 else
195 {
196 return -1;
197 }
198}
199
200void UdpShortConn::Reset()
201{

Callers 1

mt_multi_recvfromMethod · 0.45

Calls 11

GetMsgBuffMethod · 0.80
GetMaxLenMethod · 0.80
SetHaveRcvLenMethod · 0.80
DoInputMethod · 0.80
SetMsgLenMethod · 0.80
GetHaveRcvLenMethod · 0.80
GetRcvEventsMethod · 0.80
GetMsgLenMethod · 0.80
GetBuffTypeMethod · 0.80
ff_hook_recvfromFunction · 0.70
ff_hook_recvFunction · 0.70

Tested by

no test coverage detected