This commit is contained in:
shoopea 2020-01-16 21:31:56 +08:00
parent 1c44e5bc34
commit bb91db0e6a

View File

@ -1,8 +1,10 @@
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"strings"
"time"
@ -27,7 +29,8 @@ func loadClients() {
cx := ChirpClient{}
copier.Copy(&cx, &c)
cx.Active = false
clients[cx.TGUserID64] = cx
clients[cx.TGUserID64] = &cx
log.Printf("loadClients[%s] : %p\n", cx.Login, &cx)
}
muxClients.Unlock()
@ -151,9 +154,9 @@ func getLockedClient(id int64, createMissing bool) (*ChirpClient, bool) {
c.Mux.Lock()
muxClients.RUnlock()
muxClients.Lock()
clients[id] = c
clients[id] = &c
muxClients.Unlock()
return c, true
return &c, true
} else {
muxClients.RUnlock()
//c := new(ChirpClient)