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

Method GetSockLink

adapter/micro_thread/mt_net.cpp:1526–1550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1524}
1525
1526CSockLink* CDestLinks::GetSockLink()
1527{
1528 CSockLink* link = NULL;
1529 if (_curr_link < _max_links)
1530 {
1531 link = CNetMgr::Instance()->AllocSockLink();
1532 if (NULL == link)
1533 {
1534 MTLOG_ERROR("alloc sock link failed, error");
1535 return NULL;
1536 }
1537 link->SetParentsPtr(this);
1538 link->SetProtoType(_proto_type);
1539 TAILQ_INSERT_TAIL(&_sock_list, link, _link_entry);
1540 _curr_link++;
1541 }
1542 else
1543 {
1544 link = TAILQ_FIRST(&_sock_list);
1545 TAILQ_REMOVE(&_sock_list, link, _link_entry);
1546 TAILQ_INSERT_TAIL(&_sock_list, link, _link_entry);
1547 }
1548
1549 return link;
1550}
1551
1552void CDestLinks::timer_notify()
1553{

Callers 1

GetConnLinkMethod · 0.80

Calls 3

AllocSockLinkMethod · 0.80
SetParentsPtrMethod · 0.80
SetProtoTypeMethod · 0.45

Tested by

no test coverage detected