more protection against socket when closing

This commit is contained in:
Benjamin Sergeant
2019-05-15 15:18:27 -07:00
parent 7f1070dde6
commit e0d9a16985
9 changed files with 72 additions and 40 deletions

View File

@ -96,6 +96,9 @@ namespace ix
size_t closeWireSize = 0,
bool remote = false);
void closeSocket();
ssize_t send();
ReadyState getReadyState() const;
void setReadyState(ReadyState readyState);
void setOnCloseCallback(const OnCloseCallback& onCloseCallback);
@ -151,6 +154,7 @@ namespace ix
// Underlying TCP socket
std::shared_ptr<Socket> _socket;
std::mutex _socketMutex;
// Hold the state of the connection (OPEN, CLOSED, etc...)
std::atomic<ReadyState> _readyState;