diff options
author | Michael Maroszek <maroszek@gmx.net> | 2020-07-28 17:10:07 +0300 |
---|---|---|
committer | Michael Maroszek <maroszek@gmx.net> | 2020-07-28 17:10:07 +0300 |
commit | 7c578dba0209d1d13aeb3945183b92d20a704fb1 (patch) | |
tree | bf62895f1989f6d6d8dd463bebc6b0a88b2a84f0 /server_ws.hpp | |
parent | 6ee2a61a64e169471a000a8c91e498728bdc8456 (diff) |
move endpoint initialization into constructor
Diffstat (limited to 'server_ws.hpp')
-rw-r--r-- | server_ws.hpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server_ws.hpp b/server_ws.hpp index 9330301..6674e48 100644 --- a/server_ws.hpp +++ b/server_ws.hpp @@ -79,7 +79,13 @@ namespace SimpleWeb { friend class SocketServer<socket_type>; public: - Connection(std::unique_ptr<socket_type> &&socket_) noexcept : socket(std::move(socket_)), timeout_idle(0), closed(false) {} + Connection(std::unique_ptr<socket_type> &&socket_) noexcept : socket(std::move(socket_)), timeout_idle(0), closed(false) { + try { + endpoint = socket->lowest_layer().remote_endpoint(); + } + catch (...) { + } + } std::string method, path, query_string, http_version; @@ -571,12 +577,6 @@ namespace SimpleWeb { if(status_code != StatusCode::information_switching_protocols) return; - try { - connection->endpoint = connection->socket->lowest_layer().remote_endpoint(); - } - catch(...) { - } - if(!ec) { connection_open(connection, regex_endpoint.second); read_message(connection, regex_endpoint.second); |