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

Method get_local

lib_acl_cpp/src/stream/aio_stream.cpp:93–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93const char* aio_stream::get_local(bool full /* = false */) const
94{
95 if (stream_ == NULL) {
96 return "";
97 }
98
99 ACL_VSTREAM* vs = acl_aio_vstream(stream_);
100 const char* ptr = ACL_VSTREAM_LOCAL(vs);
101 ACL_SOCKET fd = ACL_VSTREAM_SOCK(vs);
102 if (ptr == NULL || *ptr == 0) {
103 char buf[256];
104 if (acl_getsockname(fd, buf, sizeof(buf)) == -1) {
105 return "";
106 }
107 acl_vstream_set_local(vs, buf);
108 }
109
110 ptr = ACL_VSTREAM_LOCAL(vs);
111 if (full) {
112 return ptr;
113 }
114
115 return const_cast<aio_stream*>
116 (this)->get_ip(ptr, const_cast<aio_stream*>(this)->ip_local_);
117}
118
119const char* aio_stream::get_ip(const char* addr, std::string& out)
120{

Callers 12

dup_streamMethod · 0.45
runMethod · 0.45
runFunction · 0.45
on_readMethod · 0.45
thread_on_acceptMethod · 0.45
on_readMethod · 0.45
proc_on_initMethod · 0.45
getLocalAddrMethod · 0.45
getLocalPortMethod · 0.45
on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
on_acceptMethod · 0.45

Calls 4

acl_aio_vstreamFunction · 0.85
acl_getsocknameFunction · 0.85
acl_vstream_set_localFunction · 0.85
get_ipMethod · 0.45

Tested by

no test coverage detected