@@ -3,6 +3,7 @@ package provisionersdk
3
3
import (
4
4
"context"
5
5
"io"
6
+ "net"
6
7
7
8
"github.com/hashicorp/yamux"
8
9
"storj.io/drpc"
@@ -17,22 +18,14 @@ const (
17
18
18
19
// TransportPipe creates an in-memory pipe for dRPC transport.
19
20
func TransportPipe () (* yamux.Session , * yamux.Session ) {
20
- clientReader , clientWriter := io .Pipe ()
21
- serverReader , serverWriter := io .Pipe ()
21
+ c1 , c2 := net .Pipe ()
22
22
yamuxConfig := yamux .DefaultConfig ()
23
23
yamuxConfig .LogOutput = io .Discard
24
- client , err := yamux .Client (& readWriteCloser {
25
- ReadCloser : clientReader ,
26
- Writer : serverWriter ,
27
- }, yamuxConfig )
24
+ client , err := yamux .Client (c1 , yamuxConfig )
28
25
if err != nil {
29
26
panic (err )
30
27
}
31
-
32
- server , err := yamux .Server (& readWriteCloser {
33
- ReadCloser : serverReader ,
34
- Writer : clientWriter ,
35
- }, yamuxConfig )
28
+ server , err := yamux .Server (c2 , yamuxConfig )
36
29
if err != nil {
37
30
panic (err )
38
31
}
@@ -44,11 +37,6 @@ func Conn(session *yamux.Session) drpc.Conn {
44
37
return & multiplexedDRPC {session }
45
38
}
46
39
47
- type readWriteCloser struct {
48
- io.ReadCloser
49
- io.Writer
50
- }
51
-
52
40
// Allows concurrent requests on a single dRPC connection.
53
41
// Required for calling functions concurrently.
54
42
type multiplexedDRPC struct {
0 commit comments