Skip to content
Snippets Groups Projects
Commit e7742489 authored by Seva's avatar Seva Committed by Adrien Béraud
Browse files

http: ignore rw ops on closed connection

parent 99fc97f3
No related branches found
No related tags found
No related merge requests found
...@@ -214,6 +214,8 @@ Connection::async_handshake(HandlerCb cb) ...@@ -214,6 +214,8 @@ Connection::async_handshake(HandlerCb cb)
void void
Connection::async_write(BytesHandlerCb cb) Connection::async_write(BytesHandlerCb cb)
{ {
if (!is_open())
return;
if (ssl_ctx_) if (ssl_ctx_)
asio::async_write(*ssl_socket_, write_buf_, cb); asio::async_write(*ssl_socket_, write_buf_, cb);
else else
...@@ -223,6 +225,8 @@ Connection::async_write(BytesHandlerCb cb) ...@@ -223,6 +225,8 @@ Connection::async_write(BytesHandlerCb cb)
void void
Connection::async_read_until(const char* delim, BytesHandlerCb cb) Connection::async_read_until(const char* delim, BytesHandlerCb cb)
{ {
if (!is_open())
return;
if (ssl_ctx_) if (ssl_ctx_)
asio::async_read_until(*ssl_socket_, read_buf_, delim, cb); asio::async_read_until(*ssl_socket_, read_buf_, delim, cb);
else else
...@@ -232,6 +236,8 @@ Connection::async_read_until(const char* delim, BytesHandlerCb cb) ...@@ -232,6 +236,8 @@ Connection::async_read_until(const char* delim, BytesHandlerCb cb)
void void
Connection::async_read(const size_t bytes, BytesHandlerCb cb) Connection::async_read(const size_t bytes, BytesHandlerCb cb)
{ {
if (!is_open())
return;
if (ssl_socket_) if (ssl_socket_)
asio::async_read(*ssl_socket_, read_buf_, asio::transfer_exactly(bytes), cb); asio::async_read(*ssl_socket_, read_buf_, asio::transfer_exactly(bytes), cb);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment