Commit d342623b authored by BogDan Vatra's avatar BogDan Vatra Committed by Eike Ziller
Browse files

Don't wait too much to connect.



Some AVDs down't allow to connect to their console,
there is no point to wait 30s (which is the default connection timeout).

Change-Id: I3cb82b99f958787215f44b471abfc203d7633089
Reviewed-by: default avatarVikas Pachdha <vikas.pachdha@theqtcompany.com>
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent d0369fe4
......@@ -588,8 +588,11 @@ QVector<AndroidDeviceInfo> AndroidConfig::connectedDevices(const QString &adbToo
else
dev.state = AndroidDeviceInfo::OkState;
if (dev.type == AndroidDeviceInfo::Emulator)
if (dev.type == AndroidDeviceInfo::Emulator) {
dev.avdname = getAvdName(dev.serialNumber);
if (dev.avdname.isEmpty())
dev.avdname = serialNo;
}
devices.push_back(dev);
}
......@@ -921,9 +924,11 @@ QString AndroidConfig::getAvdName(const QString &serialnumber)
QTcpSocket tcpSocket;
tcpSocket.connectToHost(QHostAddress(QHostAddress::LocalHost), port);
tcpSocket.waitForConnected();
if (!tcpSocket.waitForConnected(100)) // Don't wait more than 100ms for a local connection
return QString{};
tcpSocket.write(avdName + "exit\n");
tcpSocket.waitForDisconnected();
tcpSocket.waitForDisconnected(500);
QByteArray name;
const QByteArrayList response = tcpSocket.readAll().split('\n');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment