🐛 修复修改服务器导致 Agent 离线

This commit is contained in:
naiba
2021-07-25 23:50:08 +08:00
parent 4ad4bd9d5a
commit c4257ad105
6 changed files with 28 additions and 12 deletions
+4 -1
View File
@@ -35,8 +35,11 @@ func (a *AuthHandler) Check(ctx context.Context) (uint64, error) {
dao.ServerLock.RLock()
defer dao.ServerLock.RUnlock()
clientID, hasID := dao.SecretToID[clientSecret]
if !hasID {
return 0, status.Errorf(codes.Unauthenticated, "客户端认证失败")
}
_, hasServer := dao.ServerList[clientID]
if !hasID || !hasServer {
if !hasServer {
return 0, status.Errorf(codes.Unauthenticated, "客户端认证失败")
}
return clientID, nil