From fb271953f7a947c721ded63ae27f82366a93cddd Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Mon, 9 Sep 2019 16:48:26 -0700 Subject: [PATCH] websocket and http server: server does not close the bound client socket in many cases --- DOCKER_VERSION | 2 +- docs/CHANGELOG.md | 4 ++++ ixwebsocket/IXHttpServer.cpp | 1 + ixwebsocket/IXWebSocketServer.cpp | 4 +++- ixwebsocket/IXWebSocketVersion.h | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/DOCKER_VERSION b/DOCKER_VERSION index dfda3e0b..6abaeb2f 100644 --- a/DOCKER_VERSION +++ b/DOCKER_VERSION @@ -1 +1 @@ -6.1.0 +6.2.0 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 31345050..63cfd810 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. +## [6.2.0] - 2019-09-09 + +- websocket and http server: server does not close the bound client socket in many cases + ## [6.1.0] - 2019-09-08 - move poll wrapper on top of select (only used on Windows) to the ix namespace diff --git a/ixwebsocket/IXHttpServer.cpp b/ixwebsocket/IXHttpServer.cpp index 665052fa..fa928d15 100644 --- a/ixwebsocket/IXHttpServer.cpp +++ b/ixwebsocket/IXHttpServer.cpp @@ -95,6 +95,7 @@ namespace ix } } connectionState->setTerminated(); + Socket::closeSocket(fd); _connectedClientsCount--; } diff --git a/ixwebsocket/IXWebSocketServer.cpp b/ixwebsocket/IXWebSocketServer.cpp index dc895b96..a0cf2e3b 100644 --- a/ixwebsocket/IXWebSocketServer.cpp +++ b/ixwebsocket/IXWebSocketServer.cpp @@ -93,7 +93,7 @@ namespace ix else { std::stringstream ss; - ss << "WebSocketServer::handleConnection() error: " + ss << "WebSocketServer::handleConnection() HTTP status: " << status.http_status << " error: " << status.errorStr; @@ -111,6 +111,8 @@ namespace ix logInfo("WebSocketServer::handleConnection() done"); connectionState->setTerminated(); + + Socket::closeSocket(fd); } std::set> WebSocketServer::getClients() diff --git a/ixwebsocket/IXWebSocketVersion.h b/ixwebsocket/IXWebSocketVersion.h index 03aa3a09..d82a51e3 100644 --- a/ixwebsocket/IXWebSocketVersion.h +++ b/ixwebsocket/IXWebSocketVersion.h @@ -6,4 +6,4 @@ #pragma once -#define IX_WEBSOCKET_VERSION "6.1.0" +#define IX_WEBSOCKET_VERSION "6.2.0"