diff --git a/doomsday/libs/core/include/de/net/address.h b/doomsday/libs/core/include/de/net/address.h index 8d6799b20e..d1a5826c37 100644 --- a/doomsday/libs/core/include/de/net/address.h +++ b/doomsday/libs/core/include/de/net/address.h @@ -54,14 +54,14 @@ class DE_PUBLIC Address : public LogEntry::Arg::Base operator const iAddress *() const; - Address &operator=(Address const &other); + Address &operator=(const Address &other); /** * Returns the host name that was passed to lookup. */ String hostName() const; - bool operator<(Address const &other) const; + bool operator<(const Address &other) const; /** * Checks two addresses for equality. @@ -70,7 +70,7 @@ class DE_PUBLIC Address : public LogEntry::Arg::Base * * @return @c true if the addresses are equal. */ - bool operator==(Address const &other) const; + bool operator==(const Address &other) const; bool isNull() const; diff --git a/doomsday/libs/core/src/net/address.cpp b/doomsday/libs/core/src/net/address.cpp index c6735322b2..40f9ac46d5 100644 --- a/doomsday/libs/core/src/net/address.cpp +++ b/doomsday/libs/core/src/net/address.cpp @@ -81,8 +81,11 @@ Address Address::take(iAddress *addr) Address::Address(const Address &other) : d(new Impl) { - d->_addr.reset(other.d->_addr); // use the same object - d->port = other.d->port; + d->_addr.reset(other.d->_addr); // reference the same object + d->port = other.d->port; + d->pendingLookup = other.d->pendingLookup; + d->textRepr = other.d->textRepr; + d->special = other.d->special; } Address::operator const iAddress *() const @@ -90,13 +93,13 @@ Address::operator const iAddress *() const return d->get(); } -Address &Address::operator=(Address const &other) +Address &Address::operator=(const Address &other) { - d->_addr.reset(other.d->_addr); // use the same object + d->_addr.reset(other.d->_addr); // reference the same object + d->pendingLookup = other.d->pendingLookup; d->port = other.d->port; d->textRepr = other.d->textRepr; d->special = other.d->special; - d->pendingLookup = other.d->pendingLookup; return *this; } @@ -160,6 +163,15 @@ duint16 Address::port() const String Address::asText() const { + if (d->pendingLookup) + { + String str = d->pendingLookup; + if (d->port) + { + str += Stringf(":%u", d->port); + } + return str; + } if (isNull()) { return {};