From 46c147a1b257e54074750604a802e221ade38ef0 Mon Sep 17 00:00:00 2001 From: Nuno Diegues Date: Tue, 3 May 2022 18:58:14 +0100 Subject: [PATCH] TUN-6166: Fix mocked QUIC transport for UDP proxy manager to return expected error --- datagramsession/manager_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/datagramsession/manager_test.go b/datagramsession/manager_test.go index a9361624..7b17bf7d 100644 --- a/datagramsession/manager_test.go +++ b/datagramsession/manager_test.go @@ -255,7 +255,10 @@ func (rc *datagramChannel) Send(ctx context.Context, sessionID uuid.UUID, payloa case <-ctx.Done(): return ctx.Err() case <-rc.closedChan: - return fmt.Errorf("datagram channel closed") + return &errClosedSession{ + message: fmt.Errorf("datagram channel closed").Error(), + byRemote: true, + } case rc.datagramChan <- &newDatagram{sessionID: sessionID, payload: payload}: return nil } @@ -266,7 +269,11 @@ func (rc *datagramChannel) Receive(ctx context.Context) (uuid.UUID, []byte, erro case <-ctx.Done(): return uuid.Nil, nil, ctx.Err() case <-rc.closedChan: - return uuid.Nil, nil, fmt.Errorf("datagram channel closed") + err := &errClosedSession{ + message: fmt.Errorf("datagram channel closed").Error(), + byRemote: true, + } + return uuid.Nil, nil, err case msg := <-rc.datagramChan: return msg.sessionID, msg.payload, nil }