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

Method OpenCnnect

adapter/micro_thread/mt_connection.cpp:206–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206int TcpKeepConn::OpenCnnect()
207{
208 if (!_action || !_msg_buff) {
209 MTLOG_ERROR("conn not set action %p, or msg %p, error", _action, _msg_buff);
210 return -100;
211 }
212
213 int err = 0;
214 mt_hook_syscall(connect);
215 int ret = ff_hook_connect(_osfd, (struct sockaddr*)_action->GetMsgDstAddr(), sizeof(struct sockaddr_in));
216 if (ret < 0)
217 {
218 err = errno;
219 if (err == EISCONN)
220 {
221 return 0;
222 }
223 else
224 {
225 if ((err == EINPROGRESS) || (err == EALREADY) || (err == EINTR))
226 {
227 MTLOG_DEBUG("Open connect not ok, maybe first try, sock %d, errno %d", _osfd, err);
228 return -1;
229 }
230 else
231 {
232 MTLOG_ERROR("Open connect not ok, sock %d, errno %d", _osfd, err);
233 return -2;
234 }
235 }
236 }
237 else
238 {
239 return 0;
240 }
241}
242
243int TcpKeepConn::CreateSocket()
244{

Callers 1

mt_multi_openMethod · 0.45

Calls 2

GetMsgDstAddrMethod · 0.80
ff_hook_connectFunction · 0.70

Tested by

no test coverage detected