Implemented SimExternalConnection::getPeerAddress

This commit is contained in:
sfc-gh-tclinkenbeard 2020-12-19 17:31:08 -08:00
parent 9f22ae7831
commit 87282eda47
1 changed files with 7 additions and 1 deletions

View File

@ -57,7 +57,13 @@ int SimExternalConnection::write(SendBuffer const* buffer, int limit) {
}
NetworkAddress SimExternalConnection::getPeerAddress() const {
return NetworkAddress{};
auto endpoint = socket.remote_endpoint();
auto addr = endpoint.address();
if (addr.is_v6()) {
return NetworkAddress(IPAddress(addr.to_v6().to_bytes()), endpoint.port());
} else {
return NetworkAddress(addr.to_v4().to_ulong(), endpoint.port());
}
}
UID SimExternalConnection::getDebugID() const {