mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 00:11:36 +00:00
commit
169b8747d4
@ -145,7 +145,8 @@ func (c *Conn) search() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used in session keep-alive traffic
|
// Used in session keep-alive traffic
|
||||||
func (c *Conn) doSearch() {
|
func (c *Conn) _doSearch() {
|
||||||
|
s := fmt.Sprintf("conn=%p", c)
|
||||||
routerWork := func() {
|
routerWork := func() {
|
||||||
// Check to see if there is a search already matching the destination
|
// Check to see if there is a search already matching the destination
|
||||||
sinfo, isIn := c.core.router.searches.searches[*c.nodeID]
|
sinfo, isIn := c.core.router.searches.searches[*c.nodeID]
|
||||||
@ -153,7 +154,7 @@ func (c *Conn) doSearch() {
|
|||||||
// Nothing was found, so create a new search
|
// Nothing was found, so create a new search
|
||||||
searchCompleted := func(sinfo *sessionInfo, e error) {}
|
searchCompleted := func(sinfo *sessionInfo, e error) {}
|
||||||
sinfo = c.core.router.searches.newIterSearch(c.nodeID, c.nodeMask, searchCompleted)
|
sinfo = c.core.router.searches.newIterSearch(c.nodeID, c.nodeMask, searchCompleted)
|
||||||
c.core.log.Debugf("%s DHT search started: %p", c.String(), sinfo)
|
c.core.log.Debugf("%s DHT search started: %p", s, sinfo)
|
||||||
// Start the search
|
// Start the search
|
||||||
sinfo.startSearch()
|
sinfo.startSearch()
|
||||||
}
|
}
|
||||||
@ -269,7 +270,7 @@ func (c *Conn) _write(msg FlowKeyMessage) error {
|
|||||||
case time.Since(c.session.time) > 6*time.Second:
|
case time.Since(c.session.time) > 6*time.Second:
|
||||||
if c.session.time.Before(c.session.pingTime) && time.Since(c.session.pingTime) > 6*time.Second {
|
if c.session.time.Before(c.session.pingTime) && time.Since(c.session.pingTime) > 6*time.Second {
|
||||||
// TODO double check that the above condition is correct
|
// TODO double check that the above condition is correct
|
||||||
c.doSearch()
|
c._doSearch()
|
||||||
} else {
|
} else {
|
||||||
c.session.ping(c.session) // TODO send from self if this becomes an actor
|
c.session.ping(c.session) // TODO send from self if this becomes an actor
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user