mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 03:25:02 +00:00
fix:多台设备没必要分配端口
This commit is contained in:
parent
ee787ee200
commit
024e842710
2 changed files with 13 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
7
TODO.md
7
TODO.md
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue