mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
ircd::client: Improve write_all() socket checks and thrown errors.
This commit is contained in:
parent
72744824ba
commit
2e9e25fc28
1 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue