fix(channels): 探活失败不再静默 + 回执信封校验(杜绝把失败谎报成账号离线)+ echo 唯一化
This commit is contained in:
1 parent
8f6a75b7d7
commit
e1bd7c3009
3 files changed
+352
-10
No files matched your search
@@ -21,6 +21,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/channel/adapter"
|
||||
@@ -133,6 +134,9 @@ type Adapter struct {
|
||||
probeWait map[string]chan *obAPIResponse
|
||||
probeEvery time.Duration
|
||||
probeTimeout time.Duration
|
||||
// probeSeq 是 WS 探活 echo 的单调序号(见 probe.go 的 nextProbeEcho):唯一性不依赖
|
||||
// 时钟精度,两次探活绝不会撞在同一个 echo 上。
|
||||
probeSeq atomic.Uint64
|
||||
}
|
||||
|
||||
// Compile-time conformance with the channel contract.
|
||||
@@ -227,6 +231,8 @@ func (a *Adapter) Connect(ctx context.Context) error {
|
||||
go a.readLoop(a.lifeCtx)
|
||||
}
|
||||
// 账号在线探活(get_status)与连接生命周期同生共死:lifeCtx 取消即干净退出。
|
||||
// 先报一行状态再起循环:日志必须能一眼分辨「探活没跑(含原因)」与「跑了」。
|
||||
a.logProbeStart()
|
||||
if a.probeEnabled() {
|
||||
go a.runProbeLoop(a.lifeCtx)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user