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

This commit is contained in:
naiba
2021-07-25 23:50:08 +08:00
parent bcb95ba718
commit e24121bdf7
6 changed files with 28 additions and 12 deletions

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