Skip to content

Commit 63fb8de

Browse files
authored
Fix h2mux RST_STREAM on half-close
1 parent 1c5ed1c commit 63fb8de

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

client_conn.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ func (c *clientConn) Upstream() any {
9393
return c.Conn
9494
}
9595

96+
func (c *clientConn) CloseWrite() error {
97+
return N.CloseWrite(c.Conn)
98+
}
99+
96100
var _ N.NetPacketConn = (*clientPacketConn)(nil)
97101

98102
type clientPacketConn struct {

error.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net"
66

77
"github.com/hashicorp/yamux"
8+
N "github.com/sagernet/sing/common/network"
89
)
910

1011
type wrapStream struct {
@@ -23,6 +24,10 @@ func (w *wrapStream) Write(p []byte) (n int, err error) {
2324
return
2425
}
2526

27+
func (w *wrapStream) CloseWrite() error {
28+
return N.CloseWrite(w.Conn)
29+
}
30+
2631
func (w *wrapStream) Upstream() any {
2732
return w.Conn
2833
}

h2mux_conn.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ func (c *httpConn) Close() error {
6464
return common.Close(c.reader, c.writer)
6565
}
6666

67+
func (c *httpConn) CloseWrite() error {
68+
return common.Close(c.writer)
69+
}
70+
6771
func (c *httpConn) LocalAddr() net.Addr {
6872
return M.Socksaddr{}
6973
}

0 commit comments

Comments
 (0)