Skip to content

Commit 46c147a

Browse files
committed
TUN-6166: Fix mocked QUIC transport for UDP proxy manager to return expected error
1 parent 1e71202 commit 46c147a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

datagramsession/manager_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ func (rc *datagramChannel) Send(ctx context.Context, sessionID uuid.UUID, payloa
255255
case <-ctx.Done():
256256
return ctx.Err()
257257
case <-rc.closedChan:
258-
return fmt.Errorf("datagram channel closed")
258+
return &errClosedSession{
259+
message: fmt.Errorf("datagram channel closed").Error(),
260+
byRemote: true,
261+
}
259262
case rc.datagramChan <- &newDatagram{sessionID: sessionID, payload: payload}:
260263
return nil
261264
}
@@ -266,7 +269,11 @@ func (rc *datagramChannel) Receive(ctx context.Context) (uuid.UUID, []byte, erro
266269
case <-ctx.Done():
267270
return uuid.Nil, nil, ctx.Err()
268271
case <-rc.closedChan:
269-
return uuid.Nil, nil, fmt.Errorf("datagram channel closed")
272+
err := &errClosedSession{
273+
message: fmt.Errorf("datagram channel closed").Error(),
274+
byRemote: true,
275+
}
276+
return uuid.Nil, nil, err
270277
case msg := <-rc.datagramChan:
271278
return msg.sessionID, msg.payload, nil
272279
}

0 commit comments

Comments
 (0)