|
|
@@ -833,12 +833,12 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
func (h *Hub) ConnectToServerX(channel string, force bool, host *HostInfo) {
|
|
|
if host == nil {
|
|
|
if h.connectHostFunc == nil {
|
|
|
- log.Println("ConnectToServerX: not connect host func found")
|
|
|
+ log.Println("[ConnectToServerX] not connect host func found")
|
|
|
return
|
|
|
}
|
|
|
host, _ = h.connectHostFunc(channel, Direct)
|
|
|
if host == nil {
|
|
|
- log.Println("not host found for channel:", channel)
|
|
|
+ log.Println("[ConnectToServerX] not host found for channel:", channel)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
@@ -847,10 +847,10 @@ func (h *Hub) ConnectToServerX(channel string, force bool, host *HostInfo) {
|
|
|
if err == nil {
|
|
|
return
|
|
|
}
|
|
|
- log.Println("[ConnectToServer ERROR]", err)
|
|
|
+ log.Println("[ConnectToServerX] connect failed:", channel, host, err)
|
|
|
// 产生一个随机数避免刹间重连过载
|
|
|
delay := time.Duration(rand.Intn(h.cf.ConnectTimeout)+(h.cf.ConnectTimeout/2)) * time.Millisecond
|
|
|
- log.Println("[ConnectToServerX reconnect]", delay, channel, host)
|
|
|
+ log.Println("[ConnectToServerX] will reconnect with delay:", delay)
|
|
|
host = nil
|
|
|
time.Sleep(delay)
|
|
|
}
|