feat: add 2 new shutdown tests

This commit is contained in:
Toby
2023-07-26 19:12:30 -07:00
parent 37385f623f
commit 1629f0fc8e
2 changed files with 83 additions and 2 deletions

View File

@@ -149,7 +149,7 @@ func (c *clientImpl) openStream() (quic.Stream, error) {
func (c *clientImpl) TCP(addr string) (net.Conn, error) {
stream, err := c.openStream()
if err != nil {
if netErr, ok := err.(net.Error); ok && !netErr.Temporary() {
if isQUICClosedError(err) {
// Connection is dead
return nil, coreErrs.ClosedError{}
}
@@ -203,6 +203,17 @@ func (c *clientImpl) Close() error {
return nil
}
// isQUICClosedError checks if the error returned by OpenStream
// indicates that the QUIC connection is permanently closed.
func isQUICClosedError(err error) bool {
netErr, ok := err.(net.Error)
if !ok {
return true
} else {
return !netErr.Temporary()
}
}
type tcpConn struct {
Orig quic.Stream
PseudoLocalAddr net.Addr