Unverified Commit 4e665e89 authored by Marten Seemann's avatar Marten Seemann Committed by GitHub

Merge pull request #41 from libp2p/remove-send-lock

remove the sendLock in the stream
parents fc8d53ba f2c2ce6e
......@@ -40,8 +40,6 @@ type Stream struct {
recvLock sync.Mutex
recvBuf segmentedBuffer
sendLock sync.Mutex
recvNotifyCh chan struct{}
sendNotifyCh chan struct{}
......@@ -120,11 +118,8 @@ START:
}
// Write is used to write to the stream
func (s *Stream) Write(b []byte) (n int, err error) {
s.sendLock.Lock()
defer s.sendLock.Unlock()
total := 0
func (s *Stream) Write(b []byte) (int, error) {
var total int
for total < len(b) {
n, err := s.write(b[total:])
total += n
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment