From 406e74e2afdce374fd227873f4eb96a0ba99bd23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 22 Apr 2015 17:40:39 +0300 Subject: whisper: fix a small data race duirng peer connection --- whisper/peer.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'whisper/peer.go') diff --git a/whisper/peer.go b/whisper/peer.go index 28abf4260..77e09bece 100644 --- a/whisper/peer.go +++ b/whisper/peer.go @@ -23,18 +23,14 @@ type peer struct { // newPeer creates and initializes a new whisper peer connection, returning either // the newly constructed link or a failure reason. -func newPeer(host *Whisper, remote *p2p.Peer, rw p2p.MsgReadWriter) (*peer, error) { - p := &peer{ +func newPeer(host *Whisper, remote *p2p.Peer, rw p2p.MsgReadWriter) *peer { + return &peer{ host: host, peer: remote, ws: rw, known: set.New(), quit: make(chan struct{}), } - if err := p.handshake(); err != nil { - return nil, err - } - return p, nil } // start initiates the peer updater, periodically broadcasting the whisper packets -- cgit v1.2.3 From 2b9fd6b40a759078d1dcc1c7edcfafd4ccf38af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 22 Apr 2015 18:17:07 +0300 Subject: whisper: add full filter test suite --- whisper/peer.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'whisper/peer.go') diff --git a/whisper/peer.go b/whisper/peer.go index 77e09bece..9fdc28434 100644 --- a/whisper/peer.go +++ b/whisper/peer.go @@ -21,8 +21,7 @@ type peer struct { quit chan struct{} } -// newPeer creates and initializes a new whisper peer connection, returning either -// the newly constructed link or a failure reason. +// newPeer creates a new whisper peer object, but does not run the handshake itself. func newPeer(host *Whisper, remote *p2p.Peer, rw p2p.MsgReadWriter) *peer { return &peer{ host: host, -- cgit v1.2.3