mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03: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:
parent
ce98aac504
commit
abd8b69979
2 changed files with 19 additions and 14 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue