Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/Simple-WebSocket-Server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'server_ws.hpp')
-rw-r--r--server_ws.hpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/server_ws.hpp b/server_ws.hpp
index 715be40..c41ecfa 100644
--- a/server_ws.hpp
+++ b/server_ws.hpp
@@ -109,12 +109,6 @@ namespace SimpleWeb {
asio::ip::tcp::endpoint endpoint; // The endpoint is read in SocketServer::write_handshake and must be stored so that it can be read reliably in all handlers, including on_error
- void close() noexcept {
- error_code ec;
- socket->lowest_layer().shutdown(asio::ip::tcp::socket::shutdown_both, ec);
- socket->lowest_layer().cancel(ec);
- }
-
void set_timeout(long seconds = -1) noexcept {
if(seconds == -1)
seconds = timeout_idle;
@@ -259,6 +253,13 @@ namespace SimpleWeb {
send(std::move(send_stream), std::move(callback), 136);
}
+ /// Force close connection. Use `send_close()` instead for standard compliant connection close.
+ void close() noexcept {
+ error_code ec;
+ socket->lowest_layer().shutdown(asio::ip::tcp::socket::shutdown_both, ec);
+ socket->lowest_layer().cancel(ec);
+ }
+
const asio::ip::tcp::endpoint &remote_endpoint() const noexcept {
return endpoint;
}