From ce3fd07fde13995c537db6ec181adac16d4a7941 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 11 Jan 2015 00:16:19 +1100 Subject: [PATCH] Set Client.utpSock --- client.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 19458318..9809fd66 100644 --- a/client.go +++ b/client.go @@ -467,14 +467,13 @@ func NewClient(cfg *Config) (cl *Client, err error) { cl.listeners = append(cl.listeners, l) go cl.acceptConnections(l, false) } - var utpSock *utp.Socket if !cl.disableUTP { - utpSock, err = utp.NewSocket(listenAddr()) + cl.utpSock, err = utp.NewSocket(listenAddr()) if err != nil { return } - cl.listeners = append(cl.listeners, utpSock) - go cl.acceptConnections(utpSock, true) + cl.listeners = append(cl.listeners, cl.utpSock) + go cl.acceptConnections(cl.utpSock, true) } if !cfg.NoDHT { dhtCfg := cfg.DHTConfig @@ -484,8 +483,8 @@ func NewClient(cfg *Config) (cl *Client, err error) { if dhtCfg.Addr == "" { dhtCfg.Addr = listenAddr() } - if dhtCfg.Conn == nil && utpSock != nil { - dhtCfg.Conn = utpSock + if dhtCfg.Conn == nil && cl.utpSock != nil { + dhtCfg.Conn = cl.utpSock } cl.dHT, err = dht.NewServer(dhtCfg) if cl.ipBlockList != nil { -- 2.48.1