diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-04-22 22:40:39 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-04-28 15:49:05 +0800 |
commit | 406e74e2afdce374fd227873f4eb96a0ba99bd23 (patch) | |
tree | af605ae0512e7dab0802f0f8ebebe2e02f2798c1 /whisper/peer.go | |
parent | 70ded4cbf06d19993d829d843a27002cf181c619 (diff) | |
download | go-tangerine-406e74e2afdce374fd227873f4eb96a0ba99bd23.tar go-tangerine-406e74e2afdce374fd227873f4eb96a0ba99bd23.tar.gz go-tangerine-406e74e2afdce374fd227873f4eb96a0ba99bd23.tar.bz2 go-tangerine-406e74e2afdce374fd227873f4eb96a0ba99bd23.tar.lz go-tangerine-406e74e2afdce374fd227873f4eb96a0ba99bd23.tar.xz go-tangerine-406e74e2afdce374fd227873f4eb96a0ba99bd23.tar.zst go-tangerine-406e74e2afdce374fd227873f4eb96a0ba99bd23.zip |
whisper: fix a small data race duirng peer connection
Diffstat (limited to 'whisper/peer.go')
-rw-r--r-- | whisper/peer.go | 8 |
1 files changed, 2 insertions, 6 deletions
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 |