Skip to content

Commit 89cc624

Browse files
committed
Handle the EOF case and stop reading from the connection.
1 parent 2c90289 commit 89cc624

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

caddy/ws2outline_handler.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,12 @@ type wsToStreamConn struct {
176176

177177
var _ transport.StreamConn = (*wsToStreamConn)(nil)
178178

179-
func (c wsToStreamConn) CloseRead() error {
180-
return c.Close()
179+
func (c *wsToStreamConn) CloseRead() error {
180+
// Nothing to do.
181+
return nil
181182
}
182183

183-
func (c wsToStreamConn) CloseWrite() error {
184-
return nil
184+
func (c *wsToStreamConn) CloseWrite() error {
185+
return c.Conn.Close()
185186
}
187+

service/udp.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ func (h *associationHandler) HandleAssociation(ctx context.Context, clientConn n
160160
default:
161161
}
162162
clientProxyBytes, err := clientConn.Read(readBuf)
163-
if errors.Is(err, net.ErrClosed) {
163+
if errors.Is(err, net.ErrClosed) || errors.Is(err, io.EOF) {
164+
debugUDP(l, "Client closed connection")
164165
break
165166
}
166167
pkt := readBuf[:clientProxyBytes]

0 commit comments

Comments
 (0)