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
9bf38f7e
Commit
9bf38f7e
authored
Jun 19, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: whitespace
parent
70fd0fd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
message/message.go
message/message.go
+13
-6
No files found.
message/message.go
View file @
9bf38f7e
...
...
@@ -182,11 +182,14 @@ func FromMsgReader(r msgio.Reader) (BitSwapMessage, error) {
if
err
!=
nil
{
return
nil
,
err
}
var
pb
pb
.
Message
if
err
:=
pb
.
Unmarshal
(
msg
);
err
!=
nil
{
err
=
pb
.
Unmarshal
(
msg
)
r
.
ReleaseMsg
(
msg
)
if
err
!=
nil
{
return
nil
,
err
}
r
.
ReleaseMsg
(
msg
)
return
newMessageFromProto
(
pb
)
}
...
...
@@ -243,15 +246,19 @@ func (m *impl) ToNetV1(w io.Writer) error {
func
write
(
w
io
.
Writer
,
m
*
pb
.
Message
)
error
{
size
:=
m
.
Size
()
buf
:=
pool
.
Get
(
size
+
binary
.
MaxVarintLen64
)
defer
pool
.
Put
(
buf
)
n
:=
binary
.
PutUvarint
(
buf
,
uint64
(
size
))
if
written
,
err
:=
m
.
MarshalTo
(
buf
[
n
:
]);
err
!=
nil
{
written
,
err
:=
m
.
MarshalTo
(
buf
[
n
:
])
if
err
!=
nil
{
return
err
}
else
{
n
+=
written
}
_
,
err
:=
w
.
Write
(
buf
[
:
n
])
n
+=
written
_
,
err
=
w
.
Write
(
buf
[
:
n
])
return
err
}
...
...
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