forked from quic-go/quic-go
remove shutdown method on the Connection (#4249)
There's no need to have a dedicated shutdown method, as the use case (shutting down an outgoing connection attempt on context cancellation) can be achieved by using Connection.destroy.
This commit is contained in:
@@ -82,6 +82,26 @@ var _ = Describe("Handshake tests", func() {
|
||||
}()
|
||||
}
|
||||
|
||||
It("returns the context cancellation error on timeouts", func() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), scaleDuration(20*time.Millisecond))
|
||||
defer cancel()
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
_, err := quic.DialAddr(
|
||||
ctx,
|
||||
"localhost:1234", // nobody is listening on this port, but we're going to cancel this dial anyway
|
||||
getTLSClientConfig(),
|
||||
getQuicConfig(nil),
|
||||
)
|
||||
errChan <- err
|
||||
}()
|
||||
|
||||
var err error
|
||||
Eventually(errChan).Should(Receive(&err))
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err).To(MatchError(context.DeadlineExceeded))
|
||||
})
|
||||
|
||||
It("returns the cancellation reason when a dial is canceled", func() {
|
||||
ctx, cancel := context.WithCancelCause(context.Background())
|
||||
errChan := make(chan error, 1)
|
||||
|
||||
Reference in New Issue
Block a user