fix:多台设备没必要分配端口

This commit is contained in:
Barry 2019-06-20 23:30:01 +08:00
parent 4c9a88c214
commit 9f7e935cb1
2 changed files with 13 additions and 3 deletions

View file

@ -27,6 +27,8 @@ bool DeviceManage::connectDevice(Device::DeviceParams params)
qInfo("over the maximum number of connections");
return false;
}
/*
// 没有必要分配端口都用27183即可连接建立以后server会释放监听的
quint16 port = 0;
if (params.useReverse) {
port = getFreePort();
@ -34,9 +36,11 @@ bool DeviceManage::connectDevice(Device::DeviceParams params)
qInfo("no port available, automatically switch to forward");
params.useReverse = false;
} else {
params.localPort = port;
qInfo("free port %d", port);
}
}
*/
Device *device = new Device(params);
connect(device, &Device::deviceDisconnect, this, &DeviceManage::onDeviceDisconnect);
m_devices[params.serial] = device;
@ -65,10 +69,10 @@ void DeviceManage::onDeviceDisconnect(QString serial)
quint16 DeviceManage::getFreePort()
{
quint16 port = m_localPortStart;
QMapIterator<QString, QPointer<Device>> i(m_devices);
quint16 port = m_localPortStart;
while (port < m_localPortStart + DM_MAX_DEVICES_NUM) {
bool used = false;
QMapIterator<QString, QPointer<Device>> i(m_devices);
while (i.hasNext()) {
i.next();
auto device = i.value();
@ -82,6 +86,7 @@ quint16 DeviceManage::getFreePort()
if (!used) {
return port;
}
port++;
}
return 0;
}

View file

@ -6,7 +6,12 @@
2. [跳过帧改为动态配置,而不是静态编译](https://github.com/Genymobile/scrcpy/commit/ebccb9f6cc111e8acfbe10d656cac5c1f1b744a0)
3. [单独线程统计帧率](https://github.com/Genymobile/scrcpy/commit/e2a272bf99ecf48fcb050177113f903b3fb323c4)
4. ui提供show touch设置
5. ネコソリ
5. 拖拽传输文件进度条,区分安装和文件复制,提示有路径
6. 停止所有服务
7. 工具条不可拖拽
8. 启动服务/停止服务改为连接设备/断开设备
9. 置顶改为窗体置顶
10. 截屏jpg
# mark