Skip to content

Commit 580ad27

Browse files
committed
login lock
1 parent c550014 commit 580ad27

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

service/bot/bot.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"io/ioutil"
55
"os"
66
"strings"
7+
"sync"
78
"time"
89

910
"github.com/Mrs4s/MiraiGo/client"
@@ -13,6 +14,7 @@ import (
1314
)
1415

1516
var Cli *client.QQClient
17+
var LoginLock sync.Mutex
1618

1719
func InitDevice(path string) {
1820
if !util.PathExists(path) {
@@ -56,6 +58,8 @@ func InitLog(cli *client.QQClient) {
5658
}
5759

5860
func Login(cli *client.QQClient) (bool, error) {
61+
LoginLock.Lock()
62+
defer LoginLock.Unlock()
5963
cli.AllowSlider = true
6064
v, err := promise.Start(func() bool {
6165
errCount := 0

0 commit comments

Comments
 (0)