recursive mutex + enable test that was breaking on Ubuntu Xenial + gcc + tsan
This commit is contained in:
		@@ -152,7 +152,7 @@ namespace ix
 | 
				
			|||||||
        std::string errorMsg;
 | 
					        std::string errorMsg;
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool tls = protocol == "wss";
 | 
					            bool tls = protocol == "wss";
 | 
				
			||||||
            std::lock_guard<std::mutex> lock(_socketMutex);
 | 
					            std::lock_guard<std::recursive_mutex> lock(_socketMutex);
 | 
				
			||||||
            _socket = createSocket(tls, errorMsg);
 | 
					            _socket = createSocket(tls, errorMsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!_socket)
 | 
					            if (!_socket)
 | 
				
			||||||
@@ -184,7 +184,7 @@ namespace ix
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        std::string errorMsg;
 | 
					        std::string errorMsg;
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            std::lock_guard<std::mutex> lock(_socketMutex);
 | 
					            std::lock_guard<std::recursive_mutex> lock(_socketMutex);
 | 
				
			||||||
            _socket = createSocket(fd, errorMsg);
 | 
					            _socket = createSocket(fd, errorMsg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!_socket)
 | 
					            if (!_socket)
 | 
				
			||||||
@@ -956,7 +956,7 @@ namespace ix
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ssize_t WebSocketTransport::send()
 | 
					    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());
 | 
					        return _socket->send((char*)&_txbuf[0], _txbuf.size());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1010,7 +1010,7 @@ namespace ix
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    void WebSocketTransport::closeSocket()
 | 
					    void WebSocketTransport::closeSocket()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        std::lock_guard<std::mutex> lock(_socketMutex);
 | 
					        std::lock_guard<std::recursive_mutex> lock(_socketMutex);
 | 
				
			||||||
        _socket->close();
 | 
					        _socket->close();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -154,7 +154,7 @@ namespace ix
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Underlying TCP socket
 | 
					        // Underlying TCP socket
 | 
				
			||||||
        std::shared_ptr<Socket> _socket;
 | 
					        std::shared_ptr<Socket> _socket;
 | 
				
			||||||
        std::mutex _socketMutex;
 | 
					        std::recursive_mutex _socketMutex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Hold the state of the connection (OPEN, CLOSED, etc...)
 | 
					        // Hold the state of the connection (OPEN, CLOSED, etc...)
 | 
				
			||||||
        std::atomic<ReadyState> _readyState;
 | 
					        std::atomic<ReadyState> _readyState;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -140,7 +140,7 @@ TEST_CASE("websocket_connections", "[websocket]")
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // This test breaks on travis CI - Ubuntu Xenial + gcc + tsan
 | 
					    // This test breaks on travis CI - Ubuntu Xenial + gcc + tsan
 | 
				
			||||||
    // We should fix this.
 | 
					    // 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;
 | 
					        IXWebSocketTestConnectionDisconnection test;
 | 
				
			||||||
        for (int i = 0; i < 20; ++i)
 | 
					        for (int i = 0; i < 20; ++i)
 | 
				
			||||||
@@ -150,5 +150,5 @@ TEST_CASE("websocket_connections", "[websocket]")
 | 
				
			|||||||
            ix::msleep(i*50);
 | 
					            ix::msleep(i*50);
 | 
				
			||||||
            test.stop();
 | 
					            test.stop();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }*/
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user