From 30cc892def4a2d58e94378deb2153ddb8c61871d Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 12 Feb 2018 21:02:19 -0800 Subject: [PATCH] bitswap: actually *update* wantlist entries in outbound wantlist messages Before, we weren't using a pointer so we were throwing away the update. License: MIT Signed-off-by: Steven Allen --- message/message.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/message/message.go b/message/message.go index 7ede57f..9a166c9 100644 --- a/message/message.go +++ b/message/message.go @@ -50,7 +50,7 @@ type Exportable interface { type impl struct { full bool - wantlist map[string]Entry + wantlist map[string]*Entry blocks map[string]blocks.Block } @@ -61,7 +61,7 @@ func New(full bool) BitSwapMessage { func newMsg(full bool) *impl { return &impl{ blocks: make(map[string]blocks.Block), - wantlist: make(map[string]Entry), + wantlist: make(map[string]*Entry), full: full, } } @@ -122,7 +122,7 @@ func (m *impl) Empty() bool { func (m *impl) Wantlist() []Entry { out := make([]Entry, 0, len(m.wantlist)) for _, e := range m.wantlist { - out = append(out, e) + out = append(out, *e) } return out } @@ -151,7 +151,7 @@ func (m *impl) addEntry(c *cid.Cid, priority int, cancel bool) { e.Priority = priority e.Cancel = cancel } else { - m.wantlist[k] = Entry{ + m.wantlist[k] = &Entry{ Entry: &wantlist.Entry{ Cid: c, Priority: priority, -- GitLab