mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-09-15 05:02:32 +00:00
send a switch message immediately when peering, and use OS-level TCP keep-alive (shouldn't matter right now, since we have application-level keep-alive that preempts it, but important later)
This commit is contained in:
@@ -177,6 +177,7 @@ func (p *peer) doSendSwitchMsgs() {
|
||||
func (p *peer) linkLoop() {
|
||||
tick := time.NewTicker(time.Second)
|
||||
defer tick.Stop()
|
||||
p.doSendSwitchMsgs()
|
||||
for {
|
||||
select {
|
||||
case _, ok := <-p.doSend:
|
||||
@@ -185,11 +186,9 @@ func (p *peer) linkLoop() {
|
||||
}
|
||||
p.sendSwitchMsg()
|
||||
case _ = <-tick.C:
|
||||
//break // FIXME disabled the below completely to test something
|
||||
pdinfo := p.dinfo // FIXME this is a bad workarond NPE on the next line
|
||||
if pdinfo != nil {
|
||||
dinfo := *pdinfo
|
||||
p.core.dht.peers <- &dinfo
|
||||
dinfo := p.dinfo // FIXME? are pointer reads *always* atomic?
|
||||
if dinfo != nil {
|
||||
p.core.dht.peers <- dinfo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user