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
1e38b9ef
Unverified
Commit
1e38b9ef
authored
Oct 24, 2018
by
Steven Allen
Committed by
GitHub
Oct 24, 2018
Browse files
Merge pull request #464 from libp2p/fix/mock-race
fix a data-race in the mock net
parents
f046774e
841a6272
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/net/mock/mock_stream.go
View file @
1e38b9ef
...
...
@@ -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