QLocalSocket/Tcp: open device before making a connection
According to QLocalSocket's documentation, connectToServer() must initiate a connection attempt after opening the device. Otherwise, if a connection succeeds immediately, connected() signal will be emitted on closed device. So, this patch ensures that TCP-based implementation behaves correctly. Change-Id: I4cc9474815e091a1491a429a6dc17f9cf0154f58 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
457d91bb07
commit
595c6abf9d
@ -239,8 +239,8 @@ void QLocalSocket::connectToServer(OpenMode openMode)
|
||||
QLatin1String("QLocalSocket::connectToServer"));
|
||||
return;
|
||||
}
|
||||
d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode);
|
||||
QIODevice::open(openMode);
|
||||
d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode);
|
||||
}
|
||||
|
||||
bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
|
||||
|
@ -190,6 +190,7 @@ private slots:
|
||||
void slotConnected()
|
||||
{
|
||||
QCOMPARE(state(), QLocalSocket::ConnectedState);
|
||||
QVERIFY(isOpen());
|
||||
}
|
||||
void slotDisconnected()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user