Skip to content

Commit

Permalink
websocket: Change completion token not to be copied
Browse files Browse the repository at this point in the history
  • Loading branch information
kang-sw committed Sep 12, 2022
1 parent 99217d8 commit b6ec1bc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions include/crow/websocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ namespace crow
template<typename CompletionHandler>
void dispatch(CompletionHandler&& handler)
{
adaptor_.get_io_service().dispatch(std::forward<CompletionHandler>(handler));
asio::dispatch(adaptor_.get_io_service(), std::forward<CompletionHandler>(handler));
}

/// Send data through the socket and return immediately.
template<typename CompletionHandler>
void post(CompletionHandler&& handler)
{
adaptor_.get_io_service().post(std::forward<CompletionHandler>(handler));
asio::post(adaptor_.get_io_service(), std::forward<CompletionHandler>(handler));
}

/// Send a "Ping" message.
Expand Down Expand Up @@ -648,6 +648,14 @@ namespace crow
{
self->send_data_impl(this);
}

SendMessageType() noexcept = default;

SendMessageType(SendMessageType const&) = delete;
SendMessageType& operator=(SendMessageType const&) = delete;

SendMessageType(SendMessageType&&) noexcept = default;
SendMessageType& operator=(SendMessageType&&) noexcept = default;
};

static_assert(
Expand Down

0 comments on commit b6ec1bc

Please sign in to comment.