MCPcopy Create free account
hub / github.com/acl-dev/acl / get_peer

Method get_peer

lib_acl_cpp/src/stream/aio_stream.cpp:65–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65const char* aio_stream::get_peer(bool full /* = false */) const
66{
67 if (stream_ == NULL) {
68 return "";
69 }
70
71 ACL_VSTREAM* vs = acl_aio_vstream(stream_);
72 const char* ptr = ACL_VSTREAM_PEER(vs);
73
74 if (ptr == NULL || *ptr == 0) {
75 char buf[256];
76 ACL_SOCKET fd = ACL_VSTREAM_SOCK(vs);
77
78 if (acl_getpeername(fd, buf, sizeof(buf)) == -1) {
79 return "";
80 }
81 acl_vstream_set_peer(vs, buf);
82 }
83
84 ptr = ACL_VSTREAM_PEER(vs);
85 if (full) {
86 return ptr;
87 }
88
89 return const_cast<aio_stream*>
90 (this)->get_ip(ptr, const_cast<aio_stream*>(this)->ip_peer_);
91}
92
93const char* aio_stream::get_local(bool full /* = false */) const
94{

Callers 15

dup_streamMethod · 0.45
client_echoFunction · 0.45
doitMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_timeoutMethod · 0.45
thread_on_closeMethod · 0.45
mainFunction · 0.45
thread_on_acceptMethod · 0.45
thread_on_timeoutMethod · 0.45

Calls 4

acl_aio_vstreamFunction · 0.85
acl_getpeernameFunction · 0.85
acl_vstream_set_peerFunction · 0.85
get_ipMethod · 0.45

Tested by 2

runMethod · 0.36
test_subscribeFunction · 0.36