MCPcopy Index your code
hub / github.com/Monibuca/engine / WtRemote

Method WtRemote

config/remote.go:42–62  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

40}
41
42func (cfg *Engine) WtRemote(ctx context.Context) {
43 retryDelay := [...]int{2, 3, 5, 8, 13}
44 for i := 0; ctx.Err() == nil; i++ {
45 connected, err := cfg.Remote(ctx)
46 if err == nil {
47 //不需要重试了,服务器返回了错误
48 return
49 }
50 if Global.LogLang == "zh" {
51 log.Error("连接到控制台服务器", cfg.Server, "失败", err)
52 } else {
53 log.Error("connect to console server ", cfg.Server, " ", err)
54 }
55 if connected {
56 i = 0
57 } else if i >= 5 {
58 i = 4
59 }
60 time.Sleep(time.Second * time.Duration(retryDelay[i]))
61 }
62}
63
64func (cfg *Engine) Remote(ctx context.Context) (wasConnected bool, err error) {
65 tlsConf := &tls.Config{

Callers 1

OnEventMethod · 0.95

Calls 2

RemoteMethod · 0.95
ErrorFunction · 0.92

Tested by

no test coverage detected