Skip to content

Commit a803ca3

Browse files
committed
network: Modify the Address::<< operator to print a type-0 address as 00-00:00
1 parent 7ad8868 commit a803ca3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This file is a best-effort approach to solving this issue; we will do our best b
2929
* The `Ipv[4,6]Address::IsInitialized()` function has been deprecated and returns always `true`. The default value of Ipv4Address created with the constructor that takes no arguments is 0.0.0.0 (previously, it was 102.102.102.102), and an Ipv4Address instance can be checked against that unspecified address value (or use std::optional to denote an address that has not been set yet).
3030
* A new static function `Ipv[4,6]Address::CheckCompatible()` has been added to safely check if a string can be parsed as an IPv4 or IPv6 address.
3131
* (network): The address class comparison is now based on std::strong_ordering operator<=> comparison operator.
32+
* (network): An empty (uninitialized) Address is now printed as "00-00:00".
3233

3334
### Changes to build system
3435

src/network/model/address.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ ATTRIBUTE_HELPER_CPP(Address);
169169
std::ostream&
170170
operator<<(std::ostream& os, const Address& address)
171171
{
172-
if (address.m_len == 0)
172+
if (address.m_type == 0)
173173
{
174+
os << "00-00:00";
174175
return os;
175176
}
176177
std::ios_base::fmtflags ff = os.flags();

0 commit comments

Comments
 (0)