summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qsocks5socketengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/socket/qsocks5socketengine.cpp')
-rw-r--r--src/network/socket/qsocks5socketengine.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 95a0d0563a..2847b910f3 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -1002,13 +1002,17 @@ QSocks5SocketEngine::~QSocks5SocketEngine()
delete d->bindData;
}
-static QBasicAtomicInt descriptorCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
+static int nextDescriptor()
+{
+ static QBasicAtomicInt counter;
+ return 1 + counter.fetchAndAddRelaxed(1);
+}
bool QSocks5SocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol)
{
Q_D(QSocks5SocketEngine);
- d->socketDescriptor = descriptorCounter.fetchAndAddRelaxed(1);
+ d->socketDescriptor = nextDescriptor();
d->socketType = type;
d->socketProtocol = protocol;