diff --git a/include/ircd/client.h b/include/ircd/client.h index a954059eb..f22094dad 100644 --- a/include/ircd/client.h +++ b/include/ircd/client.h @@ -16,7 +16,7 @@ namespace ircd struct client; const ipport &remote(const client &); - const ipport &local(const client &); + ipport local(const client &); string_view loghead(const mutable_buffer &buf, const client &); string_view loghead(const client &); @@ -44,7 +44,6 @@ struct ircd::client unique_buffer head_buffer; unique_buffer content_buffer; std::shared_ptr sock; - net::ipport local; uint64_t id {++ctr}; uint64_t ready_count {0}; uint64_t request_count {0}; @@ -88,7 +87,7 @@ struct ircd::client static void spawn(); friend const ipport &remote(const client &); - friend const ipport &local(const client &); + friend ipport local(const client &); }; template<> diff --git a/ircd/client.cc b/ircd/client.cc index b73c927db..32904dbdf 100644 --- a/ircd/client.cc +++ b/ircd/client.cc @@ -187,10 +187,12 @@ ircd::loghead(const mutable_buffer &buf, }; } -const ircd::ipport & +ircd::ipport ircd::local(const client &client) { - return client.local; + return likely(client.sock)? + net::local_ipport(*client.sock): + net::ipport{}; } const ircd::ipport & @@ -680,10 +682,6 @@ ircd::client::client(std::shared_ptr sock) { std::move(sock) } -,local -{ - net::local_ipport(*this->sock) -} { assert(size(head_buffer) >= 8_KiB); }