Skip to content

Commit

Permalink
Merge pull request #2861 from Taraxa-project/add-check-on-ws
Browse files Browse the repository at this point in the history
chore: additional check on ws
  • Loading branch information
MatusKysel authored Oct 1, 2024
2 parents 2fbcedb + 8fb0014 commit f3beac2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libraries/core_libs/network/src/ws_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ void WsSession::on_read(beast::error_code ec, std::size_t bytes_transferred) {
}

void WsSession::processAsync() {
if (closed_) return;

std::string request(static_cast<char *>(read_buffer_.data().data()), read_buffer_.size());
read_buffer_.consume(read_buffer_.size());
LOG(log_tr_) << "processAsync " << request;
Expand All @@ -73,6 +75,8 @@ void WsSession::processAsync() {
}

void WsSession::writeAsync(std::string &&message) {
if (closed_) return;

LOG(log_tr_) << "WS WRITE " << message.c_str();
auto executor = ws_.get_executor();
if (!executor) {
Expand Down

0 comments on commit f3beac2

Please sign in to comment.