summaryrefslogtreecommitdiff
path: root/src/net/SocketAddress.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-08-21 10:49:55 +0200
committerMax Kellermann <max@musicpd.org>2018-08-21 10:49:55 +0200
commit1f3ce380eda32b790c8ca255cd467f4d1f2fc39e (patch)
tree3e29a0ba61ce68b92a2a46c3ab6a2827fb5a05ce /src/net/SocketAddress.cxx
parentdfc1f6342ada8bf581fda1c97b00ff5e3941f58d (diff)
net/SocketAddress: reimplement GetPort() using IPv4Address::GetPort()
Diffstat (limited to 'src/net/SocketAddress.cxx')
-rw-r--r--src/net/SocketAddress.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/SocketAddress.cxx b/src/net/SocketAddress.cxx
index 10286b69d..b4d1628db 100644
--- a/src/net/SocketAddress.cxx
+++ b/src/net/SocketAddress.cxx
@@ -29,6 +29,7 @@
#include "config.h"
#include "SocketAddress.hxx"
+#include "IPv4Address.hxx"
#include "IPv6Address.hxx"
#include "util/StringView.hxx"
@@ -96,7 +97,7 @@ SocketAddress::GetPort() const noexcept
switch (GetFamily()) {
case AF_INET:
- return ntohs(((const struct sockaddr_in *)(const void *)address)->sin_port);
+ return IPv4Address(*this).GetPort();
case AF_INET6:
return IPv6Address(*this).GetPort();