0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 20:28:52 +02:00

ircd::client: Improve write_all() socket checks and thrown errors.

This commit is contained in:
Jason Volk 2019-09-15 13:39:38 -07:00
parent 72744824ba
commit 2e9e25fc28

View file

@ -998,9 +998,15 @@ size_t
ircd::client::write_all(const const_buffer &buf)
{
if(unlikely(!sock))
throw error
throw std::system_error
{
"No socket to client."
make_error_code(std::errc::bad_file_descriptor)
};
if(unlikely(sock->fini))
throw std::system_error
{
make_error_code(std::errc::not_connected)
};
return net::write_all(*sock, buf);