Skip to content

Commit

Permalink
fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszWojciechO committed Oct 14, 2024
1 parent 2ee8f12 commit dac460f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions meshnet/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,18 @@ func (s *Server) EnableMeshnet(ctx context.Context, _ *pb.Empty) (*pb.MeshnetRes
}, nil
}

if cfg.Mesh {
return &pb.MeshnetResponse{
Response: &pb.MeshnetResponse_MeshnetError{
MeshnetError: pb.MeshnetErrorCode_ALREADY_ENABLED,
},
}, nil
}

if cfg.AutoConnectData.PostquantumVpn {
return &pb.MeshnetResponse{
Response: &pb.MeshnetResponse_MeshnetError{
MeshnetError: pb.MeshnetErrorCode_CONFLICT_WITH_PQ_SERVER,
MeshnetError: pb.MeshnetErrorCode_CONFLICT_WITH_PQ,
},
}, nil
}
Expand All @@ -122,7 +130,7 @@ func (s *Server) EnableMeshnet(ctx context.Context, _ *pb.Empty) (*pb.MeshnetRes
if serverData.PostQuantum {
return &pb.MeshnetResponse{
Response: &pb.MeshnetResponse_MeshnetError{
MeshnetError: pb.MeshnetErrorCode_CONFLICT_WITH_PQ,
MeshnetError: pb.MeshnetErrorCode_CONFLICT_WITH_PQ_SERVER,
},
}, nil
}
Expand All @@ -137,14 +145,6 @@ func (s *Server) EnableMeshnet(ctx context.Context, _ *pb.Empty) (*pb.MeshnetRes
}, nil
}

if cfg.Mesh {
return &pb.MeshnetResponse{
Response: &pb.MeshnetResponse_MeshnetError{
MeshnetError: pb.MeshnetErrorCode_ALREADY_ENABLED,
},
}, nil
}

token := cfg.TokensData[cfg.AutoConnectData.ID].Token
resp, err := s.reg.Map(token, cfg.MeshDevice.ID)
if err != nil {
Expand Down

0 comments on commit dac460f

Please sign in to comment.