diff options
author | rubidium <rubidium@openttd.org> | 2009-04-02 20:39:30 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-02 20:39:30 +0000 |
commit | c5160c7c8e80b1b64bf474ec1d2a54c2bcef690b (patch) | |
tree | a76360971db13f30d480449e26cf22d898d0a178 /src/network/core/address.h | |
parent | 1e205e01b83ac995c14105e0eb1f992cbd3e0625 (diff) | |
download | openttd-c5160c7c8e80b1b64bf474ec1d2a54c2bcef690b.tar.xz |
(svn r15917) -Codechange: remove the latest traces of NetworkAddress::GetIP.
Diffstat (limited to 'src/network/core/address.h')
-rw-r--r-- | src/network/core/address.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/network/core/address.h b/src/network/core/address.h index faa173493..3a4b8c06e 100644 --- a/src/network/core/address.h +++ b/src/network/core/address.h @@ -98,13 +98,6 @@ public: const sockaddr_storage *GetAddress(); /** - * Get the IP address. If the IP has not been resolved yet this will resolve - * it possibly blocking this function for a while - * @return the IP address - */ - uint32 GetIP(); - - /** * Get the port * @return the port */ @@ -131,12 +124,20 @@ public: */ bool operator == (NetworkAddress &address) { - if (this->IsResolved() != address.IsResolved()) return false; - - if (this->IsResolved()) return memcmp(&this->address, &address.address, sizeof(this->address)) == 0; - + if (this->IsResolved() && address.IsResolved()) return memcmp(&this->address, &address.address, sizeof(this->address)) == 0; return this->GetPort() == address.GetPort() && strcmp(this->GetHostname(), address.GetHostname()) == 0; } + + NetworkAddress& operator = (const NetworkAddress &other) + { + if (this != &other) { // protect against invalid self-assignment + free(this->hostname); + memcpy(this, &other, sizeof(*this)); + if (other.hostname != NULL) this->hostname = strdup(other.hostname); + } + return *this; + } + }; #endif /* ENABLE_NETWORK */ |