debug client revamping

This commit is contained in:
shoopea 2019-07-31 15:30:02 +08:00
parent 30e621c539
commit aca10f53a8

View File

@ -160,17 +160,17 @@ func MQKeepAliveWorker() {
err = json.Unmarshal(d.Body, &x)
logOnError(err, "MQKeepAliveWorker : Can't unmarshal.\n"+string(d.Body))
if err == nil {
log.Printf("MQKeepAliveWorker : Received message from %s", x.Nickname)
log.Printf("MQKeepAliveWorker : Received message from %s (%d).\n", x.Nickname, x.TGUserID64)
if x.Date.Add(10 * time.Second).Before(time.Now()) {
// outdated keep-alive coming from client
} else if clt, ok := getLockedClient(x.TGUserID64, true); ok {
clt.HeartBeat = x.Date
if clt.Active {
log.Printf("MQKeepAliveWorker : Client %s already active.\n", clt.Login)
log.Printf("MQKeepAliveWorker : Client %s (%d) already active.\n", clt.Login, clt.TGUserID64)
clt.Mux.Unlock()
} else {
clt.Login = x.Nickname
log.Printf("MQKeepAliveWorker : Connecting to %s.\n", clt.Login)
log.Printf("MQKeepAliveWorker : Connecting to %s (%d).\n", clt.Login, clt.TGUserID64)
clt.MQ.User = cfg.Rabbit.User
clt.MQ.Password = cfg.Rabbit.Password
clt.MQ.Host = cfg.Rabbit.Host