🎨 improve offline server detect

This commit is contained in:
naiba committed 2020-10-24 21:29:05 +08:00
1 parent 7143089dcb
commit 4ad8a7e61a
9 files changed
+242 -87

No files matched your search

+2
View File
@@ -3,6 +3,7 @@ package rpc
import (
"context"
"log"
"time"
"github.com/p14yground/nezha/model"
pb "github.com/p14yground/nezha/proto"
@@ -24,6 +25,7 @@ func (s *NezhaHandler) ReportState(c context.Context, r *pb.State) (*pb.Receipt,
state := model.PB2State(r)
dao.ServerLock.RLock()
defer dao.ServerLock.RUnlock()
dao.ServerList[clientID].LastActive = time.Now()
dao.ServerList[clientID].State = &state
return &pb.Receipt{Proced: true}, nil
}