mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-02 13:58:37 +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");
|
qInfo("over the maximum number of connections");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
// 没有必要分配端口,都用27183即可,连接建立以后server会释放监听的
|
||||||
quint16 port = 0;
|
quint16 port = 0;
|
||||||
if (params.useReverse) {
|
if (params.useReverse) {
|
||||||
port = getFreePort();
|
port = getFreePort();
|
||||||
|
@ -34,9 +36,11 @@ bool DeviceManage::connectDevice(Device::DeviceParams params)
|
||||||
qInfo("no port available, automatically switch to forward");
|
qInfo("no port available, automatically switch to forward");
|
||||||
params.useReverse = false;
|
params.useReverse = false;
|
||||||
} else {
|
} else {
|
||||||
|
params.localPort = port;
|
||||||
qInfo("free port %d", port);
|
qInfo("free port %d", port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
Device *device = new Device(params);
|
Device *device = new Device(params);
|
||||||
connect(device, &Device::deviceDisconnect, this, &DeviceManage::onDeviceDisconnect);
|
connect(device, &Device::deviceDisconnect, this, &DeviceManage::onDeviceDisconnect);
|
||||||
m_devices[params.serial] = device;
|
m_devices[params.serial] = device;
|
||||||
|
@ -66,9 +70,9 @@ void DeviceManage::onDeviceDisconnect(QString serial)
|
||||||
quint16 DeviceManage::getFreePort()
|
quint16 DeviceManage::getFreePort()
|
||||||
{
|
{
|
||||||
quint16 port = m_localPortStart;
|
quint16 port = m_localPortStart;
|
||||||
QMapIterator<QString, QPointer<Device>> i(m_devices);
|
|
||||||
while (port < m_localPortStart + DM_MAX_DEVICES_NUM) {
|
while (port < m_localPortStart + DM_MAX_DEVICES_NUM) {
|
||||||
bool used = false;
|
bool used = false;
|
||||||
|
QMapIterator<QString, QPointer<Device>> i(m_devices);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
auto device = i.value();
|
auto device = i.value();
|
||||||
|
@ -82,6 +86,7 @@ quint16 DeviceManage::getFreePort()
|
||||||
if (!used) {
|
if (!used) {
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
port++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
7
TODO.md
7
TODO.md
|
@ -6,7 +6,12 @@
|
||||||
2. [跳过帧改为动态配置,而不是静态编译](https://github.com/Genymobile/scrcpy/commit/ebccb9f6cc111e8acfbe10d656cac5c1f1b744a0)
|
2. [跳过帧改为动态配置,而不是静态编译](https://github.com/Genymobile/scrcpy/commit/ebccb9f6cc111e8acfbe10d656cac5c1f1b744a0)
|
||||||
3. [单独线程统计帧率](https://github.com/Genymobile/scrcpy/commit/e2a272bf99ecf48fcb050177113f903b3fb323c4)
|
3. [单独线程统计帧率](https://github.com/Genymobile/scrcpy/commit/e2a272bf99ecf48fcb050177113f903b3fb323c4)
|
||||||
4. ui提供show touch设置
|
4. ui提供show touch设置
|
||||||
5. ネコソリ
|
5. 拖拽传输文件进度条,区分安装和文件复制,提示有路径
|
||||||
|
6. 停止所有服务
|
||||||
|
7. 工具条不可拖拽
|
||||||
|
8. 启动服务/停止服务改为连接设备/断开设备
|
||||||
|
9. 置顶改为窗体置顶
|
||||||
|
10. 截屏jpg
|
||||||
|
|
||||||
|
|
||||||
# mark
|
# mark
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue