Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/bitcoin/network/net/proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BCT_API proxy
/// Connection is currently secured (TLS or comparable for socket type).
bool secure() const NOEXCEPT;

/// The socket was upgraded to a websocket (requires strand).
/// The socket was upgraded to a websocket.
bool websocket() const NOEXCEPT;

/// The total number of bytes queued/sent to the remote endpoint.
Expand Down
3 changes: 2 additions & 1 deletion include/bitcoin/network/net/socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class BCT_API socket
/// The socket upgrades to its secure configuration upon connect.
virtual bool secure() const NOEXCEPT;

/// The socket was upgraded to a websocket (requires strand).
/// The socket was upgraded to a websocket.
virtual bool websocket() const NOEXCEPT;

/// Get the address of the outgoing endpoint passed via construct, or the
Expand Down Expand Up @@ -406,6 +406,7 @@ class BCT_API socket
asio::context& service_;
const context& context_;
std::atomic_bool stopped_{};
std::atomic_bool websocket_{};

// These are protected by strand (see also handle_accept).
config::address address_;
Expand Down
4 changes: 1 addition & 3 deletions src/net/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ bool socket::inbound() const NOEXCEPT

bool socket::websocket() const NOEXCEPT
{
BC_ASSERT(stranded());
return std::holds_alternative<ws::socket>(socket_) ||
std::holds_alternative<ws::ssl::socket>(socket_);
return websocket_.load();
}

const config::address& socket::address() const NOEXCEPT
Expand Down
1 change: 1 addition & 0 deletions src/net/socket_ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ code socket::set_websocket(const http::request& request) NOEXCEPT
sock.accept(request);
}

websocket_.store(true);
return error::upgraded;
}
catch (const std::exception& e)
Expand Down
Loading