From d682f9fc9c601f22e08c2c04cfbb505eed844247 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 28 Jul 2015 10:14:58 -0400 Subject: [PATCH] BNetworkAddress: Address review comments. Thanks Axel and Rene! --- src/kits/network/libnetapi/NetworkAddress.cpp | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/kits/network/libnetapi/NetworkAddress.cpp b/src/kits/network/libnetapi/NetworkAddress.cpp index 82737dee92..92986fb3d8 100644 --- a/src/kits/network/libnetapi/NetworkAddress.cpp +++ b/src/kits/network/libnetapi/NetworkAddress.cpp @@ -151,7 +151,7 @@ BNetworkAddress::Unset() { fAddress.ss_family = AF_UNSPEC; fAddress.ss_len = 2; - fStatus = B_OK; + fStatus = B_NO_INIT; } @@ -177,8 +177,10 @@ BNetworkAddress::SetTo(const char* host, uint16 port, uint32 flags) cookie = 0; status = resolver->GetNextAddress(&cookie, *this); - if (status == B_OK) - fStatus = B_OK; + if (status != B_OK) { + Unset(); + fStatus = status; + } return status; } @@ -205,8 +207,10 @@ BNetworkAddress::SetTo(const char* host, const char* service, uint32 flags) cookie = 0; status = resolver->GetNextAddress(&cookie, *this); - if (status == B_OK) - fStatus = B_OK; + if (status != B_OK) { + Unset(); + fStatus = status; + } return status; } @@ -231,8 +235,10 @@ BNetworkAddress::SetTo(int family, const char* host, uint16 port, uint32 flags) uint32 cookie = 0; status = resolver->GetNextAddress(&cookie, *this); - if (status == B_OK) - fStatus = B_OK; + if (status != B_OK) { + Unset(); + fStatus = status; + } return status; } @@ -258,8 +264,10 @@ BNetworkAddress::SetTo(int family, const char* host, const char* service, uint32 cookie = 0; status = resolver->GetNextAddress(&cookie, *this); - if (status == B_OK) - fStatus = B_OK; + if (status != B_OK) { + Unset(); + fStatus = status; + } return status; }