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
p2p
go-yamux
Commits
5432a246
Commit
5432a246
authored
Feb 16, 2021
by
Marten Seemann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the recvLock in the stream
Concurrent use of an io.Reader is not valid.
parent
4e665e89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
stream.go
stream.go
+2
-6
No files found.
stream.go
View file @
5432a246
...
...
@@ -37,8 +37,7 @@ type Stream struct {
writeState
,
readState
halfStreamState
stateLock
sync
.
Mutex
recvLock
sync
.
Mutex
recvBuf
segmentedBuffer
recvBuf
segmentedBuffer
recvNotifyCh
chan
struct
{}
sendNotifyCh
chan
struct
{}
...
...
@@ -97,9 +96,7 @@ START:
}
// If there is no data available, block
s
.
recvLock
.
Lock
()
if
s
.
recvBuf
.
Len
()
==
0
{
s
.
recvLock
.
Unlock
()
select
{
case
<-
s
.
recvNotifyCh
:
goto
START
...
...
@@ -110,7 +107,6 @@ START:
// Read any bytes
n
,
_
=
s
.
recvBuf
.
Read
(
b
)
s
.
recvLock
.
Unlock
()
// Send a window update potentially
err
=
s
.
sendWindowUpdate
()
...
...
@@ -437,7 +433,7 @@ func (s *Stream) readData(hdr header, flags uint16, conn io.Reader) error {
s
.
session
.
logger
.
Printf
(
"[ERR] yamux: Failed to read stream data: %v"
,
err
)
return
err
}
// Unblock
any
reader
s
// Unblock
the
reader
asyncNotify
(
s
.
recvNotifyCh
)
return
nil
}
...
...
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