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:
authorMichael Maroszek <maroszek@gmx.net>2020-07-28 17:10:07 +0300
committerMichael Maroszek <maroszek@gmx.net>2020-07-28 17:10:07 +0300
commit7c578dba0209d1d13aeb3945183b92d20a704fb1 (patch)
treebf62895f1989f6d6d8dd463bebc6b0a88b2a84f0
parent6ee2a61a64e169471a000a8c91e498728bdc8456 (diff)
move endpoint initialization into constructor
-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);