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:
-rw-r--r--server_ws.hpp14
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);