0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd::net: Support interruption of UDP listening.

This commit is contained in:
Jason Volk 2018-11-29 19:16:05 -08:00
parent 13bce714ab
commit b0bfd87e9f

View file

@ -1706,6 +1706,17 @@ ircd::net::listener_udp::acceptor::operator()(datagram &datagram)
{ {
assert(ctx::current); assert(ctx::current);
const auto flags
{
this->flags(datagram.flag)
};
const auto interruption{[this]
(ctx::ctx *const &) noexcept
{
this->interrupt();
}};
this->waiting++; this->waiting++;
const unwind dec{[this] const unwind dec{[this]
{ {
@ -1715,7 +1726,7 @@ ircd::net::listener_udp::acceptor::operator()(datagram &datagram)
ip::udp::endpoint ep; ip::udp::endpoint ep;
const size_t rlen const size_t rlen
{ {
a.async_receive_from(datagram.mbufs, ep, flags(datagram.flag), yield_context{to_asio{}}) a.async_receive_from(datagram.mbufs, ep, flags, yield_context{to_asio{interruption}})
}; };
datagram.remote = make_ipport(ep); datagram.remote = make_ipport(ep);