Commit 30cc892d authored by Steven Allen's avatar Steven Allen

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: default avatarSteven Allen <steven@stebalien.com>
parent af6e6f0b
...@@ -50,7 +50,7 @@ type Exportable interface { ...@@ -50,7 +50,7 @@ type Exportable interface {
type impl struct { type impl struct {
full bool full bool
wantlist map[string]Entry wantlist map[string]*Entry
blocks map[string]blocks.Block blocks map[string]blocks.Block
} }
...@@ -61,7 +61,7 @@ func New(full bool) BitSwapMessage { ...@@ -61,7 +61,7 @@ func New(full bool) BitSwapMessage {
func newMsg(full bool) *impl { func newMsg(full bool) *impl {
return &impl{ return &impl{
blocks: make(map[string]blocks.Block), blocks: make(map[string]blocks.Block),
wantlist: make(map[string]Entry), wantlist: make(map[string]*Entry),
full: full, full: full,
} }
} }
...@@ -122,7 +122,7 @@ func (m *impl) Empty() bool { ...@@ -122,7 +122,7 @@ func (m *impl) Empty() bool {
func (m *impl) Wantlist() []Entry { func (m *impl) Wantlist() []Entry {
out := make([]Entry, 0, len(m.wantlist)) out := make([]Entry, 0, len(m.wantlist))
for _, e := range m.wantlist { for _, e := range m.wantlist {
out = append(out, e) out = append(out, *e)
} }
return out return out
} }
...@@ -151,7 +151,7 @@ func (m *impl) addEntry(c *cid.Cid, priority int, cancel bool) { ...@@ -151,7 +151,7 @@ func (m *impl) addEntry(c *cid.Cid, priority int, cancel bool) {
e.Priority = priority e.Priority = priority
e.Cancel = cancel e.Cancel = cancel
} else { } else {
m.wantlist[k] = Entry{ m.wantlist[k] = &Entry{
Entry: &wantlist.Entry{ Entry: &wantlist.Entry{
Cid: c, Cid: c,
Priority: priority, Priority: priority,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment