0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-19 19:33:45 +02:00

ircd::client: Remove redundant local endpoint state. (related 1da91f41b3)

This commit is contained in:
Jason Volk 2023-02-09 10:48:11 -08:00
parent aa8ce19c7c
commit 90f1dc77fb
2 changed files with 6 additions and 9 deletions

View file

@ -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<mutable_buffer> head_buffer;
unique_buffer<mutable_buffer> content_buffer;
std::shared_ptr<socket> 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<>

View file

@ -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<socket> sock)
{
std::move(sock)
}
,local
{
net::local_ipport(*this->sock)
}
{
assert(size(head_buffer) >= 8_KiB);
}