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

Workaround the delay between auth command return success and online command can access Internet, by adding sleep 3 #40

Closed
wants to merge 1 commit into from

Conversation

Starrah
Copy link
Collaborator

@Starrah Starrah commented Aug 30, 2024

最近观察到了一个现象(似乎以前并无这种现象):
使用goauthing认证,auth-thu auth成功返回0后,立刻发起网络请求(如auth-thu online),还是会返回自签名证书和Authentication is required。
也就是说,并不是auth4返回认证成功后就立刻能上外网,一定要等个几秒(目前测试3秒是足够的)才能成功访问外网。
测试网络环境:东配楼有线校园网 IPV4 166.111.80.0/22内。似乎IPV6无此现象。此外也有自强楼的同学反映也存在着同样的情况。

引起的问题主要是,goauthing的systemd配置实现是deauth、auth之后立刻online保活。于是由于上述延迟的存在,紧跟着auth/login命令后马上执行的online是几乎一定会挂掉(exit 1)的。于是unit failed,systemd把它自动重启,又deauth、auth、立刻online导致挂掉......导致始终无法稳定连上网。

我目前想到的比较容易的一种解决方法就是在auth/login和online之间加个sleep 3。不够优雅,但亲测有效,所以就当抛砖引玉了。

…`online`.

This is to workaround the delay between `auth` command return success and `online` command can access Internet.
@Starrah
Copy link
Collaborator Author

Starrah commented Aug 30, 2024

PS:这个PR和#39 是相互冲突的,所以可能得一个一个合

@jiegec
Copy link
Collaborator

jiegec commented Aug 30, 2024

或者修改 online 的逻辑,连续试几次?

Starrah added a commit to Starrah/GoAuthing that referenced this pull request Feb 10, 2025
…rns error.

See z4yx#40-L3.

Add 2 setting items: `onlineRetry`, which determines the maximum retry number; `onlineInterval`, which controls the interval between two keepalive requests.

Note that this commit will change the behaviour of `auth-thu online`: When the device is not authed, now `auth-thu online` will exit after 3 seconds, but for previous behaviour, `auth-thu online` will exit immediately. For equivalent with previous behaviour, you should use `auth-thu online -r 1`.
@Starrah Starrah marked this pull request as draft February 10, 2025 19:11
Starrah added a commit to Starrah/GoAuthing that referenced this pull request Feb 11, 2025
…rns error.

See z4yx#40-L3.

Add 2 setting items: `onlineRetry`, which determines the maximum retry number (default 2); `onlineInterval`, which controls the interval between two keepalive requests (default 3s).

Note that this commit will change the behaviour of `auth-thu online`: When the device is not authed, now `auth-thu online` will exit after 3 seconds, but for previous behaviour, `auth-thu online` will exit immediately. For equivalent with previous behaviour, you should use `auth-thu online -r 1`.
@jiegec jiegec closed this in #45 Feb 11, 2025
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