MCPcopy Create free account
hub / github.com/apache/brpc / endpoint2str

Function endpoint2str

src/butil/endpoint.cpp:168–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168EndPointStr endpoint2str(const EndPoint& point) {
169 EndPointStr str;
170 if (ExtendedEndPoint::is_extended(point)) {
171 ExtendedEndPoint* eep = ExtendedEndPoint::address(point);
172 if (eep) {
173 eep->to(&str);
174 } else {
175 str._buf[0] = '\0';
176 }
177 return str;
178 }
179 if (inet_ntop(AF_INET, &point.ip, str._buf, INET_ADDRSTRLEN) == NULL) {
180 return endpoint2str(EndPoint(IP_NONE, 0));
181 }
182 char* buf = str._buf + strlen(str._buf);
183 *buf++ = ':';
184 snprintf(buf, 16, "%d", point.port);
185 return str;
186}
187
188int hostname2ip(const char* hostname, ip_t* ip) {
189 char buf[256];

Callers 15

ChannelTestMethod · 0.85
TestRetryOtherServerMethod · 0.85
TestRetryBackoffMethod · 0.85
TEST_FFunction · 0.85
RdmaTestMethod · 0.85
test_listen_connectFunction · 0.85
test_parse_and_serializeFunction · 0.85
TESTFunction · 0.85
concurrent_procFunction · 0.85
TEST_FFunction · 0.85
IssueRPCMethod · 0.85
HandleSocketFailedMethod · 0.85

Calls 3

EndPointClass · 0.85
snprintfFunction · 0.85
toMethod · 0.80

Tested by 10

ChannelTestMethod · 0.68
TestRetryOtherServerMethod · 0.68
TestRetryBackoffMethod · 0.68
TEST_FFunction · 0.68
RdmaTestMethod · 0.68
test_listen_connectFunction · 0.68
test_parse_and_serializeFunction · 0.68
TESTFunction · 0.68
concurrent_procFunction · 0.68
TEST_FFunction · 0.68