recursive mutex + enable test that was breaking on Ubuntu Xenial + gcc + tsan

This commit is contained in:
Benjamin Sergeant 2019-05-15 16:01:05 -07:00
parent a7d328896c
commit 5ad15fad8b
3 changed files with 7 additions and 7 deletions

View File

@ -152,7 +152,7 @@ namespace ix
std::string errorMsg;
{
bool tls = protocol == "wss";
std::lock_guard<std::mutex> lock(_socketMutex);
std::lock_guard<std::recursive_mutex> lock(_socketMutex);
_socket = createSocket(tls, errorMsg);
if (!_socket)
@ -184,7 +184,7 @@ namespace ix
std::string errorMsg;
{
std::lock_guard<std::mutex> lock(_socketMutex);
std::lock_guard<std::recursive_mutex> lock(_socketMutex);
_socket = createSocket(fd, errorMsg);
if (!_socket)
@ -956,7 +956,7 @@ namespace ix
ssize_t WebSocketTransport::send()
{
std::lock_guard<std::mutex> lock(_socketMutex);
std::lock_guard<std::recursive_mutex> lock(_socketMutex);
return _socket->send((char*)&_txbuf[0], _txbuf.size());
}
@ -1010,7 +1010,7 @@ namespace ix
void WebSocketTransport::closeSocket()
{
std::lock_guard<std::mutex> lock(_socketMutex);
std::lock_guard<std::recursive_mutex> lock(_socketMutex);
_socket->close();
}

View File

@ -154,7 +154,7 @@ namespace ix
// Underlying TCP socket
std::shared_ptr<Socket> _socket;
std::mutex _socketMutex;
std::recursive_mutex _socketMutex;
// Hold the state of the connection (OPEN, CLOSED, etc...)
std::atomic<ReadyState> _readyState;

View File

@ -140,7 +140,7 @@ TEST_CASE("websocket_connections", "[websocket]")
// This test breaks on travis CI - Ubuntu Xenial + gcc + tsan
// We should fix this.
/*SECTION("Try to connect and disconnect with different timing, from not enough time to successfull connect")
SECTION("Try to connect and disconnect with different timing, from not enough time to successfull connect")
{
IXWebSocketTestConnectionDisconnection test;
for (int i = 0; i < 20; ++i)
@ -150,5 +150,5 @@ TEST_CASE("websocket_connections", "[websocket]")
ix::msleep(i*50);
test.stop();
}
}*/
}
}