Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #224

Merged
merged 3 commits into from
Mar 16, 2024
Merged

Dev #224

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 30 additions & 25 deletions app/i18n/lt-zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,89 +650,94 @@
<translation>被控端版本太低</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="57"/>
<location filename="../src/views/friendly_error_code.cpp" line="56"/>
<source>Access Code invalid</source>
<translation type="unfinished">验证码错误</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="58"/>
<source>Decode failed</source>
<translation>解码失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="58"/>
<location filename="../src/views/friendly_error_code.cpp" line="59"/>
<source>Render failed</source>
<translation>渲染失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="59"/>
<location filename="../src/views/friendly_error_code.cpp" line="60"/>
<source>No decode ability</source>
<translation>显卡没有检测到硬解能力</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="61"/>
<location filename="../src/views/friendly_error_code.cpp" line="62"/>
<source>Initialize decode-render pipeline failed</source>
<translation>初始化解码渲染管线失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="63"/>
<location filename="../src/views/friendly_error_code.cpp" line="64"/>
<source>Controlled side initialize video capture or video encoder failed</source>
<translation>捕捉画面失败,或是编码失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="65"/>
<location filename="../src/views/friendly_error_code.cpp" line="66"/>
<source>Controlled side initialize audio capture or audio encoder failed</source>
<translation>捕获音频失败,或是编码失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="67"/>
<location filename="../src/views/friendly_error_code.cpp" line="68"/>
<source>Controlled side initialize input executor failed</source>
<translation>模拟输入失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="69"/>
<location filename="../src/views/friendly_error_code.cpp" line="70"/>
<source>Controlled side initialize failed</source>
<translation>被控初始化失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="70"/>
<location filename="../src/views/friendly_error_code.cpp" line="103"/>
<location filename="../src/views/friendly_error_code.cpp" line="71"/>
<location filename="../src/views/friendly_error_code.cpp" line="104"/>
<source>KeepAlive timeout</source>
<translation>心跳超时</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="71"/>
<location filename="../src/views/friendly_error_code.cpp" line="72"/>
<source>Target is serving another client</source>
<translation>目标正在为其它客户端服务</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="72"/>
<location filename="../src/views/friendly_error_code.cpp" line="73"/>
<source>Initialize transport failed</source>
<translation>初始化传输模块失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="73"/>
<location filename="../src/views/friendly_error_code.cpp" line="84"/>
<location filename="../src/views/friendly_error_code.cpp" line="74"/>
<location filename="../src/views/friendly_error_code.cpp" line="85"/>
<source>Peer user rejected you request</source>
<translation>对方拒绝你的连接请求</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="76"/>
<location filename="../src/views/friendly_error_code.cpp" line="77"/>
<source>Request for allocating Device ID failed, server has no available ID, pleaese contact the server owner to fix it</source>
<translation>向服务器申请设备码失败,服务器没有剩余设备码可供分配,请联系服务器管理员修复这个问题</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="79"/>
<location filename="../src/views/friendly_error_code.cpp" line="80"/>
<source>Login device failed, invalid device ID</source>
<translation>登录设备失败,原因是设备码不正确</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="81"/>
<location filename="../src/views/friendly_error_code.cpp" line="82"/>
<source>Login device failed, server has invalid status</source>
<translation>登录设备失败,服务器内部产生没有考虑到的状态</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="86"/>
<location filename="../src/views/friendly_error_code.cpp" line="87"/>
<source>Request connection failed, server has invalid status</source>
<translation>请求连接失败,服务器内部产生没有考虑到的状态</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="88"/>
<location filename="../src/views/friendly_error_code.cpp" line="89"/>
<source>Request connection failed, probably controlled side is serving another clinet</source>
<translation>请求连接失败,可能是被控端正在服务其它客户端</translation>
</message>
Expand All @@ -749,27 +754,27 @@
<translation type="vanished">请求连接失败,服务器未能为这次连接创建订单,可能是被控端正在服务其它客户端,也可能是被控端的&apos;lanthing.exe&apos;进程卡住了。如果是后者,请尝试杀掉所有的&apos;lanthing.exe&apos;和&apos;app.exe&apos;进程,再启动试试</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="91"/>
<location filename="../src/views/friendly_error_code.cpp" line="92"/>
<source>Request connection failed, peer not online</source>
<translation>请求连接失败,对方不在线</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="92"/>
<location filename="../src/views/friendly_error_code.cpp" line="93"/>
<source>Request connection timeout</source>
<translation>请求超时</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="95"/>
<location filename="../src/views/friendly_error_code.cpp" line="96"/>
<source>Signaling server error, join room failed</source>
<translation>信令服务器错误,加入房间失败</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="100"/>
<location filename="../src/views/friendly_error_code.cpp" line="101"/>
<source>Controlled module disconnected from server</source>
<translation>被控模块与服务器断开连接</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="102"/>
<location filename="../src/views/friendly_error_code.cpp" line="103"/>
<source>Connect timeout</source>
<translation>连接超时</translation>
</message>
Expand All @@ -790,7 +795,7 @@
<translation type="vanished">信令服务器错误,加入房间失败,可能是bug导致的</translation>
</message>
<message>
<location filename="../src/views/friendly_error_code.cpp" line="97"/>
<location filename="../src/views/friendly_error_code.cpp" line="98"/>
<source>Send signaling message failed, peer not online</source>
<translation>发送信令消息失败,对方未连接信令服务器</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions app/src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,9 @@ void App::sendKeepAlive() {
}
auto msg = std::make_shared<ltproto::common::KeepAlive>();
sendMessage(ltproto::id(msg), msg);
// 10秒发一个心跳包,当前服务端不会检测超时
// 5秒发一个心跳包,当前服务端不会检测超时
// 但是反向代理比如nginx可能设置了proxy_timeout,超过这个时间没有包就会被断链
postDelayTask(10'000, std::bind(&App::sendKeepAlive, this));
postDelayTask(5'000, std::bind(&App::sendKeepAlive, this));
}

void App::handleAllocateDeviceIdAck(std::shared_ptr<google::protobuf::MessageLite> msg) {
Expand Down
1 change: 1 addition & 0 deletions app/src/views/friendly_error_code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ QString errorCode2FriendlyMessage(int32_t code) {
{ltproto::ErrorCode::StartServiceFailed, QObject::tr("Start service failed")},
{ltproto::ErrorCode::ClientVresionTooLow, QObject::tr("Client version too low")},
{ltproto::ErrorCode::HostVersionTooLow, QObject::tr("Host version too low")},
{ltproto::ErrorCode::AccessCodeInvalid, QObject::tr("Access Code invalid")},
// 10000~ *******************************************
{ltproto::ErrorCode::DecodeFailed, QObject::tr("Decode failed")},
{ltproto::ErrorCode::RenderFailed, QObject::tr("Render failed")},
Expand Down
8 changes: 4 additions & 4 deletions lanthing/src/service/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ void Service::onOpenConnection(std::shared_ptr<google::protobuf::MessageLite> _m
}
std::optional<std::string> access_token = settings_->getString("access_token");
if (!access_token.has_value() || access_token.value().empty()) {
ack->set_err_code(ltproto::ErrorCode::AuthFailed);
ack->set_err_code(ltproto::ErrorCode::AccessCodeInvalid);
tcp_client_->send(ltproto::id(ack), ack);
LOG(ERR) << "Get access_token from local settings failed";
return;
}
if (msg->access_token() != access_token.value()) {
ack->set_err_code(ltproto::ErrorCode::AuthFailed);
ack->set_err_code(ltproto::ErrorCode::AccessCodeInvalid);
tcp_client_->send(ltproto::id(ack), ack);
LOG(ERR) << "Received connection with invalid access_token: " << msg->access_token();
return;
Expand Down Expand Up @@ -414,9 +414,9 @@ void Service::onLoginUserAck(std::shared_ptr<google::protobuf::MessageLite> msg)
void Service::sendKeepAliveToServer() {
auto msg = std::make_shared<ltproto::common::KeepAlive>();
sendMessageToServer(ltproto::id(msg), msg);
// 10秒发一个心跳包,当前服务端不会检测超时
// 5秒发一个心跳包,当前服务端不会检测超时
// 但是反向代理比如nginx可能设置了proxy_timeout,超过这个时间没有包就会被断链
postDelayTask(10'000, std::bind(&Service::sendKeepAliveToServer, this));
postDelayTask(5'000, std::bind(&Service::sendKeepAliveToServer, this));
}

void Service::onCreateSessionCompletedThreadSafe(
Expand Down
2 changes: 1 addition & 1 deletion ltproto