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

Function get_local_side

src/butil/endpoint.cpp:592–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590}
591
592int get_local_side(int fd, EndPoint *out) {
593 struct sockaddr_storage addr;
594 socklen_t socklen = sizeof(addr);
595 const int rc = getsockname(fd, (struct sockaddr*)&addr, &socklen);
596 if (rc != 0) {
597 return rc;
598 }
599 if (out) {
600 return sockaddr2endpoint(&addr, socklen, out);
601 }
602 return 0;
603}
604
605int get_remote_side(int fd, EndPoint *out) {
606 struct sockaddr_storage addr;

Callers 4

test_listen_connectFunction · 0.85
ResetFileDescriptorMethod · 0.85
CheckConnectedMethod · 0.85
tcp_connectFunction · 0.85

Calls 1

sockaddr2endpointFunction · 0.85

Tested by 1

test_listen_connectFunction · 0.68