File tree 6 files changed +23
-13
lines changed
6 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ require (
32
32
github.com/libp2p/go-nat v0.2.0
33
33
github.com/libp2p/go-netroute v0.2.1
34
34
github.com/libp2p/go-reuseport v0.4.0
35
- github.com/libp2p/go-yamux/v4 v4.0.2-0.20241120100319-39abe7ed206a
35
+ github.com/libp2p/go-yamux/v4 v4.0.2-0.20241121144427-4ad80596076b
36
36
github.com/libp2p/zeroconf/v2 v2.2.0
37
37
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd
38
38
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b
Original file line number Diff line number Diff line change @@ -194,8 +194,8 @@ github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9t
194
194
github.com/libp2p/go-netroute v0.2.1 /go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ =
195
195
github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s =
196
196
github.com/libp2p/go-reuseport v0.4.0 /go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU =
197
- github.com/libp2p/go-yamux/v4 v4.0.2-0.20241120100319-39abe7ed206a h1:zc7jPWFFQibZbACDyQdEAWg7yG/fjx5Jmg6djtpjKog =
198
- github.com/libp2p/go-yamux/v4 v4.0.2-0.20241120100319-39abe7ed206a /go.mod h1:PGP+3py2ZWDKABvqstBZtMnixEHNC7U/odnGylzur5o =
197
+ github.com/libp2p/go-yamux/v4 v4.0.2-0.20241121144427-4ad80596076b h1:HWXTC6mwQRnPIgm0rgMAOIi/jebt/5AOa81EfU/fPPE =
198
+ github.com/libp2p/go-yamux/v4 v4.0.2-0.20241121144427-4ad80596076b /go.mod h1:PGP+3py2ZWDKABvqstBZtMnixEHNC7U/odnGylzur5o =
199
199
github.com/libp2p/zeroconf/v2 v2.2.0 h1:Cup06Jv6u81HLhIj1KasuNM/RHHrJ8T7wOTS4+Tv53Q =
200
200
github.com/libp2p/zeroconf/v2 v2.2.0 /go.mod h1:fuJqLnUwZTshS3U/bMRJ3+ow/v9oid1n0DmyYyNO1Xs =
201
201
github.com/lunixbochs/vtclean v1.0.0 /go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI =
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ func (c *conn) Close() error {
23
23
return c .yamux ().Close ()
24
24
}
25
25
26
- func (c * conn ) CloseWithError (errCode network.ConnErrorCode ) error {
27
- return c .yamux ().CloseWithError (uint32 (errCode ))
26
+ func (c * conn ) CloseWithErrorChan (errCode network.ConnErrorCode ) chan error {
27
+ return c .yamux ().CloseWithErrorChan (uint32 (errCode ))
28
28
}
29
29
30
30
// IsClosed checks if yamux.Session is in closed state.
@@ -36,7 +36,7 @@ func (c *conn) IsClosed() bool {
36
36
func (c * conn ) OpenStream (ctx context.Context ) (network.MuxedStream , error ) {
37
37
s , err := c .yamux ().OpenStream (ctx )
38
38
if err != nil {
39
- return nil , parseResetError ( err )
39
+ return nil , err
40
40
}
41
41
42
42
return (* stream )(s ), nil
@@ -45,7 +45,7 @@ func (c *conn) OpenStream(ctx context.Context) (network.MuxedStream, error) {
45
45
// AcceptStream accepts a stream opened by the other side.
46
46
func (c * conn ) AcceptStream () (network.MuxedStream , error ) {
47
47
s , err := c .yamux ().AcceptStream ()
48
- return (* stream )(s ), parseResetError ( err )
48
+ return (* stream )(s ), err
49
49
}
50
50
51
51
func (c * conn ) yamux () * yamux.Session {
Original file line number Diff line number Diff line change @@ -65,9 +65,19 @@ func (t *transportConn) ConnState() network.ConnectionState {
65
65
}
66
66
67
67
func (t * transportConn ) CloseWithError (errCode network.ConnErrorCode ) error {
68
- defer t .scope .Done ()
69
- if ce , ok := t .MuxedConn .(network.CloseWithErrorer ); ok {
70
- return ce .CloseWithError (errCode )
68
+ if ce , ok := t .MuxedConn .(interface {
69
+ CloseWithErrorChan (errCode network.ConnErrorCode ) chan error
70
+ }); ok {
71
+ err := t .scope .ReserveMemory (10_000 , network .ReservationPriorityMedium )
72
+ if err != nil {
73
+ return t .Close ()
74
+ }
75
+ errCh := ce .CloseWithErrorChan (errCode )
76
+ go func () {
77
+ defer t .scope .Done ()
78
+ <- errCh
79
+ }()
80
+ return nil
71
81
}
72
82
return t .Close ()
73
83
}
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ require (
46
46
github.com/libp2p/go-nat v0.2.0 // indirect
47
47
github.com/libp2p/go-netroute v0.2.1 // indirect
48
48
github.com/libp2p/go-reuseport v0.4.0 // indirect
49
- github.com/libp2p/go-yamux/v4 v4.0.2-0.20241120100319-39abe7ed206a // indirect
49
+ github.com/libp2p/go-yamux/v4 v4.0.2-0.20241121144427-4ad80596076b // indirect
50
50
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
51
51
github.com/mattn/go-isatty v0.0.20 // indirect
52
52
github.com/miekg/dns v1.1.62 // indirect
Original file line number Diff line number Diff line change @@ -150,8 +150,8 @@ github.com/libp2p/go-netroute v0.2.1 h1:V8kVrpD8GK0Riv15/7VN6RbUQ3URNZVosw7H2v9t
150
150
github.com/libp2p/go-netroute v0.2.1 /go.mod h1:hraioZr0fhBjG0ZRXJJ6Zj2IVEVNx6tDTFQfSmcq7mQ =
151
151
github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s =
152
152
github.com/libp2p/go-reuseport v0.4.0 /go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU =
153
- github.com/libp2p/go-yamux/v4 v4.0.2-0.20241120100319-39abe7ed206a h1:zc7jPWFFQibZbACDyQdEAWg7yG/fjx5Jmg6djtpjKog =
154
- github.com/libp2p/go-yamux/v4 v4.0.2-0.20241120100319-39abe7ed206a /go.mod h1:PGP+3py2ZWDKABvqstBZtMnixEHNC7U/odnGylzur5o =
153
+ github.com/libp2p/go-yamux/v4 v4.0.2-0.20241121144427-4ad80596076b h1:HWXTC6mwQRnPIgm0rgMAOIi/jebt/5AOa81EfU/fPPE =
154
+ github.com/libp2p/go-yamux/v4 v4.0.2-0.20241121144427-4ad80596076b /go.mod h1:PGP+3py2ZWDKABvqstBZtMnixEHNC7U/odnGylzur5o =
155
155
github.com/lunixbochs/vtclean v1.0.0 /go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI =
156
156
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe /go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc =
157
157
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk =
You can’t perform that action at this time.
0 commit comments