fix
This commit is contained in:
parent
9cac3d34b8
commit
223b9f87d0
26
codec.go
26
codec.go
|
@ -171,29 +171,3 @@ func sizeForAddr(p Protocol, b []byte) (skip, size int, err error) {
|
|||
return n, size, nil
|
||||
}
|
||||
}
|
||||
|
||||
func bytesSplit(b []byte) ([][]byte, error) {
|
||||
var ret [][]byte
|
||||
for len(b) > 0 {
|
||||
code, n, err := multiaddr.ReadVarintCode(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p := ProtocolWithCode(code)
|
||||
if p.Code == 0 {
|
||||
return nil, fmt.Errorf("no protocol with code %d", b[0])
|
||||
}
|
||||
|
||||
n2, size, err := sizeForAddr(p, b[n:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
length := n + n2 + size
|
||||
ret = append(ret, b[:length])
|
||||
b = b[length:]
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
multiprotocol.Init("testdata/multiprotocol.csv")
|
||||
_ = multiprotocol.Init("testdata/multiprotocol.csv")
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue