diff --git a/ixwebsocket/IXWebSocketTransport.cpp b/ixwebsocket/IXWebSocketTransport.cpp index 1e7f4923..9e8b2d7c 100644 --- a/ixwebsocket/IXWebSocketTransport.cpp +++ b/ixwebsocket/IXWebSocketTransport.cpp @@ -68,7 +68,6 @@ namespace ix const int WebSocketTransport::kDefaultPingIntervalSecs(-1); const int WebSocketTransport::kDefaultPingTimeoutSecs(-1); const bool WebSocketTransport::kDefaultEnablePong(true); - const int WebSocketTransport::kClosingMaximumWaitingDelayInMs(100); constexpr size_t WebSocketTransport::kChunkSize; const uint16_t WebSocketTransport::kInternalErrorCode(1011); @@ -88,7 +87,6 @@ namespace ix _closeRemote(false), _enablePerMessageDeflate(false), _requestInitCancellation(false), - _closingTimePoint(std::chrono::steady_clock::now()), _enablePong(kDefaultEnablePong), _pingIntervalSecs(kDefaultPingIntervalSecs), _pingTimeoutSecs(kDefaultPingTimeoutSecs), @@ -245,13 +243,6 @@ namespace ix return now - _lastReceivePongTimePoint > std::chrono::seconds(_pingTimeoutSecs); } - bool WebSocketTransport::closingDelayExceeded() - { - std::lock_guard lock(_closingTimePointMutex); - auto now = std::chrono::steady_clock::now(); - return now - _closingTimePoint > std::chrono::milliseconds(kClosingMaximumWaitingDelayInMs); - } - WebSocketTransport::PollPostTreatment WebSocketTransport::poll() { PollResultType pollResult = _socket->poll(_pingIntervalOrTimeoutGCDSecs); @@ -333,7 +324,7 @@ namespace ix _socket->close(); } - if (_readyState == CLOSING /*&& closingDelayExceeded()*/) + if (_readyState == CLOSING) { // close code and reason were set when calling close() _socket->close(); @@ -935,10 +926,6 @@ namespace ix _closeWireSize = closeWireSize; _closeRemote = remote; } - { - std::lock_guard lock(_closingTimePointMutex); - _closingTimePoint = std::chrono::steady_clock::now(); - } setReadyState(CLOSING); _socket->wakeUpFromPoll(Socket::kSendRequest); diff --git a/ixwebsocket/IXWebSocketTransport.h b/ixwebsocket/IXWebSocketTransport.h index 9b94949b..873d875e 100644 --- a/ixwebsocket/IXWebSocketTransport.h +++ b/ixwebsocket/IXWebSocketTransport.h @@ -168,11 +168,7 @@ namespace ix // Used to cancel dns lookup + socket connect + http upgrade std::atomic _requestInitCancellation; - - mutable std::mutex _closingTimePointMutex; - std::chrono::time_point_closingTimePoint; - static const int kClosingMaximumWaitingDelayInMs; - + // Constants for dealing with closing conneections static const uint16_t kInternalErrorCode; static const uint16_t kAbnormalCloseCode;