mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 08:23:56 +01:00
ircd::net: Convey ALPN selection to socket instance.
This commit is contained in:
parent
47d1ac40c3
commit
a70a6164be
3 changed files with 15 additions and 2 deletions
|
@ -59,6 +59,7 @@ struct ircd::net::socket
|
|||
stat in, out;
|
||||
deadline_timer timer;
|
||||
uint64_t timer_sem[2] {0}; // handler, sender
|
||||
char alpn[12] {0};
|
||||
bool timer_set {false}; // boolean lockout
|
||||
bool timedout {false};
|
||||
bool fini {false};
|
||||
|
|
|
@ -1047,14 +1047,23 @@ const
|
|||
thread_local char buf[512];
|
||||
thread_local char rembuf[128];
|
||||
thread_local char locbuf[128];
|
||||
|
||||
const string_view alpn
|
||||
{
|
||||
sock?
|
||||
sock->alpn:
|
||||
nullptr
|
||||
};
|
||||
|
||||
return fmt::sprintf
|
||||
{
|
||||
buf, "socket:%lu local:%s remote:%s client:%lu req:%lu:%lu",
|
||||
buf, "socket:%lu local:%s remote:%s client:%lu %s %lu:%lu",
|
||||
sock? net::id(*sock) : -1UL,
|
||||
string(locbuf, ircd::local(*this)),
|
||||
string(rembuf, ircd::remote(*this)),
|
||||
id,
|
||||
alpn?: "h1"_sv,
|
||||
ready_count,
|
||||
request_count
|
||||
request_count,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -851,7 +851,10 @@ ircd::net::acceptor::handle_alpn(socket &socket,
|
|||
//NOTE: proto == "h2" condition goes here
|
||||
for(const auto &proto : in)
|
||||
if(proto == "http/1.1")
|
||||
{
|
||||
strlcpy(socket.alpn, proto);
|
||||
return proto;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue