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

fix: procd script cannot auto re-auth (procd脚本不能在掉线之后自动重新登录) #39

Merged
merged 1 commit into from
Aug 31, 2024

Conversation

Starrah
Copy link
Contributor

@Starrah Starrah commented Aug 30, 2024

修复了procd脚本:docs/init.d/goauthing的问题。

之前的版本里,"deauth-auth-login"这个过程是通过start_pre()函数实现的:

start_pre() {
"$PROG" -c "$CONF" -D deauth
"$PROG" -c "$CONF" -D auth
"$PROG" -c "$CONF" -D login
}

然而,原来的版本却只把start_pre()写成了start_service()中一次性调用的东西,而不是procd_set_param command调用的内容,而只有后者才是procd的respwan功能在进程退出时会去尝试重启的东西。

start_service() {
start_pre
procd_open_instance
procd_set_param command "$PROG"
procd_append_param command -c "$CONF" -D online
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}

以下内容的测试环境为OpenWrt 23.05.2:
之前的的情况是:

  1. 由于某种原因掉线了
  2. online进程退出
  3. procd检测到,尝试respwan command参数中所设置的命令
  4. procd拉起auth-thu online进程
  5. 由于并没有执行过auth-thu auth命令恢复上线,所以网络还是处于不在线的状态。当然很快,online进程就又退出
  6. 回到第2步。

本PR尝试修复这个问题,通过把"deauth-auth-login-online"四步作为一个整体,以shell的方式传递给procd。这样如果online进程退出,procd在respwan时,就会再次尝试完整的"deauth-auth-login-online"四步过程,而不是反复地尝试online。

In previous version, start_pre() is executed ONLY ONCE when the script is loaded by procd, while ONLY the "online" command is set as procd's instance command.
This causes procd will only try to respawn the "online" command, rather than "deauth-auth-login" again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants