Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 602e725

Browse files
committed
Merge branch 'readclose' into apps
2 parents c57f8dd + 8e61cac commit 602e725

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

provisionersdk/transport.go

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package provisionersdk
33
import (
44
"context"
55
"io"
6+
"sync"
67

78
"github.com/hashicorp/yamux"
89
"storj.io/drpc"
@@ -45,11 +46,14 @@ func Conn(session *yamux.Session) drpc.Conn {
4546
}
4647

4748
type readWriteCloser struct {
49+
closeMutex sync.Mutex
4850
io.ReadCloser
4951
io.WriteCloser
5052
}
5153

5254
func (c *readWriteCloser) Close() error {
55+
c.closeMutex.Lock()
56+
defer c.closeMutex.Unlock()
5357
err := c.ReadCloser.Close()
5458
if err != nil {
5559
return err

0 commit comments

Comments
 (0)