| 91 | } |
| 92 | |
| 93 | const 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 | |
| 119 | const char* aio_stream::get_ip(const char* addr, std::string& out) |
| 120 | { |
no test coverage detected