parent
3365facf9f
commit
26de9b9714
@ -1041,42 +1041,23 @@ namespace ix
|
|||||||
_requestInitCancellation = true;
|
_requestInitCancellation = true;
|
||||||
|
|
||||||
if (_readyState == ReadyState::CLOSING || _readyState == ReadyState::CLOSED) return;
|
if (_readyState == ReadyState::CLOSING || _readyState == ReadyState::CLOSED) return;
|
||||||
|
|
||||||
// connection is opened, so close without sending close frame
|
|
||||||
if (_readyState == ReadyState::OPEN)
|
|
||||||
{
|
{
|
||||||
{
|
std::lock_guard<std::mutex> lock(_closeDataMutex);
|
||||||
std::lock_guard<std::mutex> lock(_closeDataMutex);
|
_closeCode = code;
|
||||||
_closeCode = code;
|
_closeReason = reason;
|
||||||
_closeReason = reason;
|
_closeWireSize = closeWireSize;
|
||||||
_closeWireSize = closeWireSize;
|
_closeRemote = remote;
|
||||||
_closeRemote = remote;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(_closingTimePointMutex);
|
|
||||||
_closingTimePoint = std::chrono::steady_clock::now();
|
|
||||||
}
|
|
||||||
setReadyState(ReadyState::CLOSING);
|
|
||||||
|
|
||||||
sendCloseFrame(code, reason);
|
|
||||||
// wake up the poll, but do not close yet
|
|
||||||
_socket->wakeUpFromPoll(Socket::kSendRequest);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
{
|
||||||
{
|
std::lock_guard<std::mutex> lock(_closingTimePointMutex);
|
||||||
std::lock_guard<std::mutex> lock(_closeDataMutex);
|
_closingTimePoint = std::chrono::steady_clock::now();
|
||||||
_closeCode = code;
|
|
||||||
_closeReason = reason;
|
|
||||||
_closeWireSize = closeWireSize;
|
|
||||||
_closeRemote = remote;
|
|
||||||
}
|
|
||||||
|
|
||||||
setReadyState(ReadyState::CLOSED);
|
|
||||||
|
|
||||||
// wake up the poll, and close
|
|
||||||
_socket->wakeUpFromPoll(Socket::kCloseRequest);
|
|
||||||
}
|
}
|
||||||
|
setReadyState(ReadyState::CLOSING);
|
||||||
|
|
||||||
|
sendCloseFrame(code, reason);
|
||||||
|
// wake up the poll, but do not close yet
|
||||||
|
_socket->wakeUpFromPoll(Socket::kSendRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WebSocketTransport::bufferedAmount() const
|
size_t WebSocketTransport::bufferedAmount() const
|
||||||
|
Loading…
Reference in New Issue
Block a user