From e662209754f3f7f7463f75ce322a841306e245e9 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 28 Aug 2015 09:48:55 -0700 Subject: [PATCH] use a QMutex instead of QReadWriteMutex --- libraries/networking/src/udt/Socket.cpp | 6 +++--- libraries/networking/src/udt/Socket.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index c9a681abfc..f3ce095b50 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -143,7 +143,7 @@ qint64 Socket::writeDatagram(const QByteArray& datagram, const HifiSockAddr& soc } Connection& Socket::findOrCreateConnection(const HifiSockAddr& sockAddr) { - QWriteLocker locker(&_connectionsMutex); + QMutexLocker locker(&_connectionsMutex); auto it = _connectionsHash.find(sockAddr); @@ -162,7 +162,7 @@ void Socket::clearConnections() { return; } - QWriteLocker locker(&_connectionsMutex); + QMutexLocker locker(&_connectionsMutex); // clear all of the current connections in the socket qDebug() << "Clearing all remaining connections in Socket."; @@ -170,7 +170,7 @@ void Socket::clearConnections() { } void Socket::cleanupConnection(HifiSockAddr sockAddr) { - QWriteLocker locker(&_connectionsMutex); + QMutexLocker locker(&_connectionsMutex); qCDebug(networking) << "Socket::cleanupConnection called for UDT connection to" << sockAddr; _connectionsHash.erase(sockAddr); diff --git a/libraries/networking/src/udt/Socket.h b/libraries/networking/src/udt/Socket.h index fa6bf874a8..23dd313462 100644 --- a/libraries/networking/src/udt/Socket.h +++ b/libraries/networking/src/udt/Socket.h @@ -94,7 +94,7 @@ private: std::unordered_map _unreliableSequenceNumbers; std::unordered_map> _connectionsHash; - QReadWriteLock _connectionsMutex; // guards concurrent access to connections hashs + QMutex _connectionsMutex; // guards concurrent access to connections hashs int _synInterval = 10; // 10ms QTimer _synTimer;