From ec719e33fac752f74e0541752c1de28d682553ba Mon Sep 17 00:00:00 2001 From: Jeffrey Picard Date: Fri, 4 Nov 2022 01:40:43 +0000 Subject: [PATCH] fixed data race finally.... --- server/federation.go | 2 +- server/federation_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/federation.go b/server/federation.go index 6ffce60..82d3f04 100644 --- a/server/federation.go +++ b/server/federation.go @@ -374,7 +374,7 @@ func (s *Server) addPeer(newPeer *Peer, ping bool, subscribe bool) error { // This is weird because we're doing grpc and jsonrpc here. // Do we still want to custom grpc? log.Warn("Sending peer to NotifierChan") - s.NotifierChan <- newPeer + s.NotifierChan <- peerNotification{newPeer.Address, newPeer.Port} // Subscribe to all our peers for now if subscribe { diff --git a/server/federation_test.go b/server/federation_test.go index 0c09436..214da7b 100644 --- a/server/federation_test.go +++ b/server/federation_test.go @@ -93,7 +93,6 @@ func TestAddPeer(t *testing.T) { log.Println(err) } } - hubServer.Stop() var m = &dto.Metric{} if err := metrics.PeersKnown.Write(m); err != nil { t.Errorf("Error getting metrics %+v\n", err) @@ -102,6 +101,7 @@ func TestAddPeer(t *testing.T) { if got != tt.want { t.Errorf("len(server.PeerServers) = %d, want %d\n", got, tt.want) } + hubServer.Stop() }) }