mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
ircd::net::socket: Minor cleanup; move warning into unlikely branch.
This commit is contained in:
parent
6da9219039
commit
56c025ab7b
2 changed files with 14 additions and 15 deletions
|
@ -105,15 +105,12 @@ struct ircd::net::socket
|
|||
void wait(const wait_opts &);
|
||||
void wait(const wait_opts &, wait_callback_ec);
|
||||
void wait(const wait_opts &, wait_callback_eptr);
|
||||
|
||||
void cancel() noexcept;
|
||||
|
||||
// Alias to wait()
|
||||
template<class... args> auto operator()(args&&...);
|
||||
template<class... args> auto operator()(args&&...); // Alias to wait()
|
||||
|
||||
void disconnect(const close_opts &, eptr_handler);
|
||||
void handshake(const open_opts &, eptr_handler);
|
||||
void connect(const endpoint &, const open_opts &, eptr_handler);
|
||||
bool cancel() noexcept;
|
||||
|
||||
socket(asio::ssl::context & = sslv23_client,
|
||||
boost::asio::io_service & = ios::get());
|
||||
|
|
22
ircd/net.cc
22
ircd/net.cc
|
@ -2966,7 +2966,7 @@ catch(const std::exception &e)
|
|||
};
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
ircd::net::socket::cancel()
|
||||
noexcept
|
||||
{
|
||||
|
@ -2974,16 +2974,18 @@ noexcept
|
|||
|
||||
boost::system::error_code ec;
|
||||
sd.cancel(ec);
|
||||
if(likely(!ec))
|
||||
return;
|
||||
|
||||
thread_local char ecbuf[64];
|
||||
log::dwarning
|
||||
if(unlikely(ec))
|
||||
{
|
||||
log, "socket:%lu cancel :%s",
|
||||
this->id,
|
||||
string(ecbuf, ec)
|
||||
};
|
||||
thread_local char ecbuf[64];
|
||||
log::dwarning
|
||||
{
|
||||
log, "socket:%lu cancel :%s",
|
||||
this->id,
|
||||
string(ecbuf, ec)
|
||||
};
|
||||
}
|
||||
|
||||
return !ec;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue