Fix QUdpSocket bindMode autotest regression
authorShane <shane.kearns@accenture.com>
Wed, 14 Mar 2012 13:18:20 +0000 (13:18 +0000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 15 Mar 2012 17:05:05 +0000 (18:05 +0100)
When binding with the DefaultForPlatform bindmode, then don't set
options on the socket related to sharability, leave them at the
platform default.

This restores compatiblity with Qt 4

Change-Id: I612a3acb976f08446b4eef03ccdcdf84b3477c3c
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
src/network/socket/qabstractsocket.cpp

index 2f66671..af22b20 100644 (file)
@@ -1457,6 +1457,7 @@ bool QAbstractSocket::bind(const QHostAddress &address, quint16 port, BindMode m
             return false;
     }
 
+    if (mode != DefaultForPlatform) {
 #ifdef Q_OS_UNIX
     if ((mode & ShareAddress) || (mode & ReuseAddressHint))
         d->socketEngine->setOption(QAbstractSocketEngine::AddressReusable, 1);
@@ -1473,6 +1474,7 @@ bool QAbstractSocket::bind(const QHostAddress &address, quint16 port, BindMode m
     else
         d->socketEngine->setOption(QAbstractSocketEngine::BindExclusively, 0);
 #endif
+    }
     bool result = d->socketEngine->bind(address, port);
     d->cachedSocketDescriptor = d->socketEngine->socketDescriptor();