Skip to content

Commit c88b9ac

Browse files
committed
Remove setters from fly::net::Endpoint
The awkward use case that required these has been removed.
1 parent 74bbdbc commit c88b9ac

File tree

2 files changed

+0
-67
lines changed

2 files changed

+0
-67
lines changed

fly/net/endpoint.hpp

-42
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,11 @@ class Endpoint
7777
*/
7878
static constexpr std::optional<Endpoint> from_string(std::string_view endpoint);
7979

80-
/**
81-
* Set the endpoint's IP address.
82-
*
83-
* @param address The endoint's new IP address.
84-
*/
85-
void set_address(const IPAddressType &address);
86-
87-
/**
88-
* Set the endpoint's IP address.
89-
*
90-
* @param address The endoint's new IP address.
91-
*/
92-
void set_address(IPAddressType &&address);
93-
9480
/**
9581
* @return The endoint's IP address.
9682
*/
9783
constexpr const IPAddressType &address() const;
9884

99-
/**
100-
* Set the endpoint's port.
101-
*
102-
* @param port The endoint's new port.
103-
*/
104-
void set_port(port_type port);
105-
10685
/**
10786
* @return The endoint's IP port.
10887
*/
@@ -211,20 +190,6 @@ Endpoint<IPAddressType>::from_string(std::string_view endpoint)
211190
return Endpoint(*std::move(address), static_cast<port_type>(*port));
212191
}
213192

214-
//==================================================================================================
215-
template <typename IPAddressType>
216-
void Endpoint<IPAddressType>::set_address(const IPAddressType &address)
217-
{
218-
m_address = address;
219-
}
220-
221-
//==================================================================================================
222-
template <typename IPAddressType>
223-
void Endpoint<IPAddressType>::set_address(IPAddressType &&address)
224-
{
225-
m_address = std::move(address);
226-
}
227-
228193
//==================================================================================================
229194
template <typename IPAddressType>
230195
constexpr const IPAddressType &Endpoint<IPAddressType>::address() const
@@ -239,13 +204,6 @@ constexpr port_type Endpoint<IPAddressType>::port() const
239204
return m_port;
240205
}
241206

242-
//==================================================================================================
243-
template <typename IPAddressType>
244-
void Endpoint<IPAddressType>::set_port(port_type port)
245-
{
246-
m_port = port;
247-
}
248-
249207
#if !defined(FLY_LINUX)
250208

251209
//==================================================================================================

test/net/endpoint.cpp

-25
Original file line numberDiff line numberDiff line change
@@ -88,31 +88,6 @@ CATCH_TEMPLATE_TEST_CASE("Endpoint", "[net]", fly::net::IPv4Address, fly::net::I
8888
static_assert(endpoint2 < endpoint3);
8989
}
9090

91-
CATCH_SECTION("Endpoints may be updated")
92-
{
93-
auto endpoint = EndpointType(IPAddressType::in_addr_any(), 1);
94-
95-
CATCH_CHECK(endpoint.address() == IPAddressType::in_addr_any());
96-
CATCH_CHECK(endpoint.port() == 1);
97-
98-
const auto address1 = IPAddressType::in_addr_loopback();
99-
endpoint.set_address(address1);
100-
101-
CATCH_CHECK(endpoint.address() == address1);
102-
CATCH_CHECK(endpoint.port() == 1);
103-
104-
auto address2 = IPAddressType::in_addr_loopback();
105-
endpoint.set_address(std::move(address2));
106-
107-
CATCH_CHECK(endpoint.address() == address1);
108-
CATCH_CHECK(endpoint.port() == 1);
109-
110-
endpoint.set_port(2);
111-
112-
CATCH_CHECK(endpoint.address() == address1);
113-
CATCH_CHECK(endpoint.port() == 2);
114-
}
115-
11691
if constexpr (EndpointType::is_ipv4())
11792
{
11893
CATCH_SECTION("Endpoints may be converted to a string")

0 commit comments

Comments
 (0)