expose local endpoint

This commit is contained in:
Michael Maroszek 2020-07-28 11:36:54 +02:00
commit 8e82428740

View file

@ -241,6 +241,16 @@ namespace SimpleWeb {
return asio::ip::tcp::endpoint(); return asio::ip::tcp::endpoint();
} }
asio::ip::tcp::endpoint local_endpoint() const noexcept {
try {
if(auto connection = this->connection.lock())
return connection->socket->lowest_layer().local_endpoint();
}
catch(...) {
}
return asio::ip::tcp::endpoint();
}
/// Deprecated, please use remote_endpoint().address().to_string() instead. /// Deprecated, please use remote_endpoint().address().to_string() instead.
DEPRECATED std::string remote_endpoint_address() const noexcept { DEPRECATED std::string remote_endpoint_address() const noexcept {
try { try {