client.go | 22 +++++++++++++--------- diff --git a/client.go b/client.go index 00a474c584b4c97c4370daee92e3a0c10e86d279..cae1ee7a80209804335cde47c7e608fc25370dd7 100644 --- a/client.go +++ b/client.go @@ -200,13 +200,17 @@ func listen(tcp, utp bool, networkSuffix, addr string) (tcpL net.Listener, utpSock *utp.Socket, listenedAddr string, err error) { if addr == "" { addr = ":50007" } - host, port, err := missinggo.ParseHostPort(addr) - if err != nil { - return - } - if tcp && utp && port == 0 { - // If both protocols are active, they need to have the same port. - return listenBothSameDynamicPort(networkSuffix, host) + if tcp && utp { + var host string + var port int + host, port, err = missinggo.ParseHostPort(addr) + if err != nil { + return + } + if port == 0 { + // If both protocols are active, they need to have the same port. + return listenBothSameDynamicPort(networkSuffix, host) + } } defer func() { if err != nil { @@ -1405,8 +1409,8 @@ // Specifies a new torrent for adding to a client. There are helpers for // magnet URIs and torrent metainfo files. type TorrentSpec struct { // The tiered tracker URIs. - Trackers [][]string - InfoHash metainfo.Hash + Trackers [][]string + InfoHash metainfo.Hash InfoBytes []byte // The name to use if the Name field from the Info isn't available. DisplayName string