Reduce a local variable (#2363)

This commit is contained in:
lifenjoiner 2023-04-06 20:22:21 +08:00 committed by GitHub
parent b341c21dbd
commit 6d826afac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -280,13 +280,11 @@ func (xTransport *XTransport) rebuildTransport() {
if err != nil {
return nil, err
}
var udpConn *net.UDPConn
if xTransport.h3UDPConn == nil {
udpConn, err = net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: 0})
xTransport.h3UDPConn, err = net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: 0})
if err != nil {
return nil, err
}
xTransport.h3UDPConn = udpConn
}
return quic.DialEarlyContext(ctx, xTransport.h3UDPConn, udpAddr, host, tlsCfg, cfg)
}}