From ab579f5de0dd450f016b79a06a958fa5b18f826d Mon Sep 17 00:00:00 2001 From: braginini Date: Sat, 1 Jan 2022 14:53:49 +0100 Subject: [PATCH] chore: [management] - fix golint --- management/server/grpcserver.go | 3 +++ management/server/peer.go | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/management/server/grpcserver.go b/management/server/grpcserver.go index f6c8275c4..f21bc479d 100644 --- a/management/server/grpcserver.go +++ b/management/server/grpcserver.go @@ -163,6 +163,9 @@ func (s *Server) schedulePeerUpdates(context context.Context, peerKey string, pe update := toSyncResponse(s.config, peer, peers, nil) err = s.peersUpdateManager.SendUpdate(peerKey, &UpdateMessage{Update: update}) + if err != nil { + continue + } } } }() diff --git a/management/server/peer.go b/management/server/peer.go index a15d0a0db..9873fb415 100644 --- a/management/server/peer.go +++ b/management/server/peer.go @@ -1,6 +1,7 @@ package server import ( + "github.com/wiretrustee/wiretrustee/management/proto" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "net" @@ -122,7 +123,8 @@ func (am *AccountManager) DeletePeer(accountId string, peerKey string) (*Peer, e return nil, err } - /*err = am.peersUpdateManager.SendUpdate(peerKey, + // notify peer itself + err = am.peersUpdateManager.SendUpdate(peerKey, &UpdateMessage{ Update: &proto.SyncResponse{ RemotePeers: []*proto.RemotePeerConfig{}, @@ -130,10 +132,10 @@ func (am *AccountManager) DeletePeer(accountId string, peerKey string) (*Peer, e }}) if err != nil { return nil, err - }*/ + } //notify other peers of the change - peers, err := am.Store.GetAccountPeers(accountId) + /*peers, err := am.Store.GetAccountPeers(accountId) if err != nil { return nil, err } @@ -145,7 +147,7 @@ func (am *AccountManager) DeletePeer(accountId string, peerKey string) (*Peer, e peersToSend = append(peersToSend, remote) } } - /*update := toRemotePeerConfig(peersToSend) + update := toRemotePeerConfig(peersToSend) err = am.peersUpdateManager.SendUpdate(p.Key, &UpdateMessage{ Update: &proto.SyncResponse{ @@ -154,8 +156,8 @@ func (am *AccountManager) DeletePeer(accountId string, peerKey string) (*Peer, e }}) if err != nil { return nil, err - }*/ - } + } + } */ am.peersUpdateManager.CloseChannel(peerKey) return peer, nil