Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
841a6272
Commit
841a6272
authored
Oct 24, 2018
by
Steven Allen
Browse files
fix a data-race in the mock net
This was causing
https://github.com/ipfs/go-ipfs/pull/5637#issuecomment-432792969
parent
30e4db24
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/net/mock/mock_stream.go
View file @
841a6272
...
...
@@ -56,6 +56,11 @@ func (s *stream) Write(p []byte) (n int, err error) {
l
:=
s
.
conn
.
link
delay
:=
l
.
GetLatency
()
+
l
.
RateLimit
(
len
(
p
))
t
:=
time
.
Now
()
.
Add
(
delay
)
// Copy it.
cpy
:=
make
([]
byte
,
len
(
p
))
copy
(
cpy
,
p
)
select
{
case
<-
s
.
closed
:
// bail out if we're closing.
return
0
,
s
.
writeErr
...
...
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