TUN-6166: Fix mocked QUIC transport for UDP proxy manager to return expected error
This commit is contained in:
parent
1e71202c89
commit
46c147a1b2
|
@ -255,7 +255,10 @@ func (rc *datagramChannel) Send(ctx context.Context, sessionID uuid.UUID, payloa
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
case <-rc.closedChan:
|
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}:
|
case rc.datagramChan <- &newDatagram{sessionID: sessionID, payload: payload}:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -266,7 +269,11 @@ func (rc *datagramChannel) Receive(ctx context.Context) (uuid.UUID, []byte, erro
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return uuid.Nil, nil, ctx.Err()
|
return uuid.Nil, nil, ctx.Err()
|
||||||
case <-rc.closedChan:
|
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:
|
case msg := <-rc.datagramChan:
|
||||||
return msg.sessionID, msg.payload, nil
|
return msg.sessionID, msg.payload, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue