refactor: simplify topology gossip gob decoder initialisation
Should be more efficient too due to less copying.
This commit is contained in:
1 parent
62bbaf57a2
commit
34e3f0ba3f
1 file changed
+1
-3
+1
-3
@@ -206,9 +206,7 @@ func (peers *Peers) decodeUpdate(update []byte) (newPeers map[PeerName]*Peer, de
|
|||||||
decodedUpdate = []*Peer{}
|
decodedUpdate = []*Peer{}
|
||||||
decodedConns = [][]ConnectionSummary{}
|
decodedConns = [][]ConnectionSummary{}
|
||||||
|
|
||||||
updateBuf := new(bytes.Buffer)
|
decoder := gob.NewDecoder(bytes.NewReader(update))
|
||||||
updateBuf.Write(update)
|
|
||||||
decoder := gob.NewDecoder(updateBuf)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
peerSummary, connSummaries, decErr := decodePeer(decoder)
|
peerSummary, connSummaries, decErr := decodePeer(decoder)
|
||||||
|
|||||||
Reference in new issue
Block a user