mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-08-14 05:11:50 +00:00
feat: add 2 new shutdown tests
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user