MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / Connect

Method Connect

src/test/pcp_tests.cpp:137–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135 }
136
137 int Connect(const sockaddr* sa, socklen_t sa_len) const override {
138 CService service;
139 if (service.SetSockAddr(sa, sa_len) && service == CService(m_gateway_ip, 5351)) {
140 if (m_bound.IsBindAny()) { // If bind-any, bind to local ip.
141 m_bound = CService(m_local_ip, 0);
142 }
143 if (m_bound.GetPort() == 0) { // If no port assigned, assign port 1.
144 m_bound = CService(m_bound, 1);
145 }
146 m_connected = true;
147 return 0;
148 }
149 return -1;
150 }
151
152 int Bind(const sockaddr* sa, socklen_t sa_len) const override {
153 CService service;

Callers

nothing calls this directly

Calls 4

CServiceClass · 0.85
SetSockAddrMethod · 0.80
IsBindAnyMethod · 0.80
GetPortMethod · 0.80

Tested by

no test coverage detected