func (m *impl) Reset(full bool) {
	m.full = full
	for k := range m.wantlist {
		delete(m.wantlist, k)
	}
	for k := range m.blocks {
		delete(m.blocks, k)
	}
	for k := range m.blockPresences {
		delete(m.blockPresences, k)
	}
	m.pendingBytes = 0
}
Reset the values in the message back to defaults, so it can be reused
package message
import (
	"encoding/binary"
	"errors"
	"io"
	pb "github.com/ipfs/go-bitswap/message/pb"
	"github.com/ipfs/go-bitswap/wantlist"
	blocks "github.com/ipfs/go-block-format"
	cid "github.com/ipfs/go-cid"
	pool "github.com/libp2p/go-buffer-pool"
	msgio "github.com/libp2p/go-msgio"
	u "github.com/ipfs/go-ipfs-util"
	"github.com/libp2p/go-libp2p-core/network"
)
type BitSwapMessage interface {
	Wantlist() []Entry
	Blocks() []blocks.Block
	BlockPresences() []BlockPresence
	Haves() []cid.Cid
	DontHaves() []cid.Cid
	PendingBytes() int32
	AddEntry(key cid.Cid, priority int32, wantType pb.Message_Wantlist_WantType, sendDontHave bool) int
	Cancel(key cid.Cid) int
	Remove(key cid.Cid)
	Empty() bool
	Size() int
	Full() bool
	AddBlock(blocks.Block)
	AddBlockPresence(cid.Cid, pb.Message_BlockPresenceType)
	AddHave(cid.Cid)
	AddDontHave(cid.Cid)
	SetPendingBytes(int32)
	Exportable
	Loggable() map[string]interface{}
	Reset(bool)
	Clone() BitSwapMessage
}
type Exportable interface {
	ToProtoV0() *pb.Message
	ToProtoV1() *pb.Message
	ToNetV0(w io.Writer) error
	ToNetV1(w io.Writer) error
}
type BlockPresence struct {
	Cid  cid.Cid
	Type pb.Message_BlockPresenceType
}
type Entry struct {
	wantlist.Entry
	Cancel       bool
	SendDontHave bool
}
func (e *Entry) Size() int {
	epb := e.ToPB()
	return epb.Size()
}
func (e *Entry) ToPB() pb.Message_Wantlist_Entry {
	return pb.Message_Wantlist_Entry{
		Block:        pb.Cid{Cid: e.Cid},
		Priority:     int32(e.Priority),
		Cancel:       e.Cancel,
		WantType:     e.WantType,
		SendDontHave: e.SendDontHave,
	}
}
var MaxEntrySize = maxEntrySize()
func maxEntrySize() int {
	var maxInt32 int32 = (1 << 31) - 1
	c := cid.NewCidV0(u.Hash([]byte("cid")))
	e := Entry{
		Entry: wantlist.Entry{
			Cid:      c,
			Priority: maxInt32,
			WantType: pb.Message_Wantlist_Have,
		},
		SendDontHave: true,  
		Cancel:       true,
	}
	return e.Size()
}
type impl struct {
	full           bool
	wantlist       map[cid.Cid]*Entry
	blocks         map[cid.Cid]blocks.Block
	blockPresences map[cid.Cid]pb.Message_BlockPresenceType
	pendingBytes   int32
}
func New(full bool) BitSwapMessage {
	return newMsg(full)
}
func newMsg(full bool) *impl {
	return &impl{
		full:           full,
		wantlist:       make(map[cid.Cid]*Entry),
		blocks:         make(map[cid.Cid]blocks.Block),
		blockPresences: make(map[cid.Cid]pb.Message_BlockPresenceType),
	}
}
func (m *impl) Clone() BitSwapMessage {
	msg := newMsg(m.full)
	for k := range m.wantlist {
		msg.wantlist[k] = m.wantlist[k]
	}
	for k := range m.blocks {
		msg.blocks[k] = m.blocks[k]
	}
	for k := range m.blockPresences {
		msg.blockPresences[k] = m.blockPresences[k]
	}
	msg.pendingBytes = m.pendingBytes
	return msg
}