Fix bug in mask generation for outbound dials, change iface reader mutexes to read-only locks unless RW is needed

This commit is contained in:
Neil Alexander 2019-04-22 11:49:47 +01:00
parent ccf03fd3b6
commit bbd1246f7b
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 19 additions and 13 deletions

View file

@ -35,7 +35,7 @@ func (d *Dialer) Dial(network, address string) (Conn, error) {
return Conn{}, err
}
copy(nodeID[:], dest)
for idx := 0; idx <= len; idx++ {
for idx := 0; idx < len; idx++ {
nodeMask[idx/8] |= 0x80 >> byte(idx%8)
}
} else {
@ -65,8 +65,8 @@ func (d *Dialer) DialByNodeIDandMask(nodeID, nodeMask *crypto.NodeID) (Conn, err
nodeMask: nodeMask,
recv: make(chan *wire_trafficPacket, 32),
}
conn.core.router.doAdmin(func() {
conn.core.router.admin <- func() {
conn.startSearch()
})
}
return conn, nil
}