@cryptotaxi247 / kubo / commits / d4d30f4e8

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 <steven@stebalien.com>

Steven Allen committed Feb 12, 2018 at 21:02 UTC d4d30f4e8a0d08a95cbbe635d05a4318be095793
1 file changed +4 -4
exchange/bitswap/message/message.go
+4 -4
@@ -50,7 +50,7 @@ type Exportable interface {
50
51 type impl struct {
52 full bool
53 - wantlist map[string]Entry
53 + wantlist map[string]*Entry
54 blocks map[string]blocks.Block
55 }
56
@@ -61,7 +61,7 @@ func New(full bool) BitSwapMessage {
61 func newMsg(full bool) *impl {
62 return &impl{
63 blocks: make(map[string]blocks.Block),
64 - wantlist: make(map[string]Entry),
64 + wantlist: make(map[string]*Entry),
65 full: full,
66 }
67 }
@@ -122,7 +122,7 @@ func (m *impl) Empty() bool {
122 func (m *impl) Wantlist() []Entry {
123 out := make([]Entry, 0, len(m.wantlist))
124 for _, e := range m.wantlist {
125 - out = append(out, e)
125 + out = append(out, *e)
126 }
127 return out
128 }
@@ -151,7 +151,7 @@ func (m *impl) addEntry(c *cid.Cid, priority int, cancel bool) {
151 e.Priority = priority
152 e.Cancel = cancel
153 } else {
154 - m.wantlist[k] = Entry{
154 + m.wantlist[k] = &Entry{
155 Entry: &wantlist.Entry{
156 Cid: c,
157 Priority: priority,