Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-bitswap
Commits
ecd52489
Commit
ecd52489
authored
Dec 02, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bitswap: add wantlist fullness to protobuf messages
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
parent
e0bdf543
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
message/message.go
message/message.go
+2
-0
message/message_test.go
message/message_test.go
+4
-0
No files found.
message/message.go
View file @
ecd52489
...
@@ -189,6 +189,7 @@ func (m *impl) ToProtoV0() *pb.Message {
...
@@ -189,6 +189,7 @@ func (m *impl) ToProtoV0() *pb.Message {
Cancel
:
proto
.
Bool
(
e
.
Cancel
),
Cancel
:
proto
.
Bool
(
e
.
Cancel
),
})
})
}
}
pbm
.
Wantlist
.
Full
=
proto
.
Bool
(
m
.
full
)
for
_
,
b
:=
range
m
.
Blocks
()
{
for
_
,
b
:=
range
m
.
Blocks
()
{
pbm
.
Blocks
=
append
(
pbm
.
Blocks
,
b
.
RawData
())
pbm
.
Blocks
=
append
(
pbm
.
Blocks
,
b
.
RawData
())
}
}
...
@@ -205,6 +206,7 @@ func (m *impl) ToProtoV1() *pb.Message {
...
@@ -205,6 +206,7 @@ func (m *impl) ToProtoV1() *pb.Message {
Cancel
:
proto
.
Bool
(
e
.
Cancel
),
Cancel
:
proto
.
Bool
(
e
.
Cancel
),
})
})
}
}
pbm
.
Wantlist
.
Full
=
proto
.
Bool
(
m
.
full
)
for
_
,
b
:=
range
m
.
Blocks
()
{
for
_
,
b
:=
range
m
.
Blocks
()
{
blk
:=
&
pb
.
Message_Block
{
blk
:=
&
pb
.
Message_Block
{
Data
:
b
.
RawData
(),
Data
:
b
.
RawData
(),
...
...
message/message_test.go
View file @
ecd52489
...
@@ -118,6 +118,10 @@ func TestToNetFromNetPreservesWantList(t *testing.T) {
...
@@ -118,6 +118,10 @@ func TestToNetFromNetPreservesWantList(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
if
!
copied
.
Full
()
{
t
.
Fatal
(
"fullness attribute got dropped on marshal"
)
}
keys
:=
make
(
map
[
string
]
bool
)
keys
:=
make
(
map
[
string
]
bool
)
for
_
,
k
:=
range
copied
.
Wantlist
()
{
for
_
,
k
:=
range
copied
.
Wantlist
()
{
keys
[
k
.
Cid
.
KeyString
()]
=
true
keys
[
k
.
Cid
.
KeyString
()]
=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment