Set Client.utpSock
This commit is contained in:
parent
39b9eb1d37
commit
ce3fd07fde
11
client.go
11
client.go
@ -467,14 +467,13 @@ func NewClient(cfg *Config) (cl *Client, err error) {
|
|||||||
cl.listeners = append(cl.listeners, l)
|
cl.listeners = append(cl.listeners, l)
|
||||||
go cl.acceptConnections(l, false)
|
go cl.acceptConnections(l, false)
|
||||||
}
|
}
|
||||||
var utpSock *utp.Socket
|
|
||||||
if !cl.disableUTP {
|
if !cl.disableUTP {
|
||||||
utpSock, err = utp.NewSocket(listenAddr())
|
cl.utpSock, err = utp.NewSocket(listenAddr())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cl.listeners = append(cl.listeners, utpSock)
|
cl.listeners = append(cl.listeners, cl.utpSock)
|
||||||
go cl.acceptConnections(utpSock, true)
|
go cl.acceptConnections(cl.utpSock, true)
|
||||||
}
|
}
|
||||||
if !cfg.NoDHT {
|
if !cfg.NoDHT {
|
||||||
dhtCfg := cfg.DHTConfig
|
dhtCfg := cfg.DHTConfig
|
||||||
@ -484,8 +483,8 @@ func NewClient(cfg *Config) (cl *Client, err error) {
|
|||||||
if dhtCfg.Addr == "" {
|
if dhtCfg.Addr == "" {
|
||||||
dhtCfg.Addr = listenAddr()
|
dhtCfg.Addr = listenAddr()
|
||||||
}
|
}
|
||||||
if dhtCfg.Conn == nil && utpSock != nil {
|
if dhtCfg.Conn == nil && cl.utpSock != nil {
|
||||||
dhtCfg.Conn = utpSock
|
dhtCfg.Conn = cl.utpSock
|
||||||
}
|
}
|
||||||
cl.dHT, err = dht.NewServer(dhtCfg)
|
cl.dHT, err = dht.NewServer(dhtCfg)
|
||||||
if cl.ipBlockList != nil {
|
if cl.ipBlockList != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user