5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 10:40:27 +00:00

Merge pull request #696 from Arceliar/bugfix

Bugfix
This commit is contained in:
Arceliar 2020-05-23 11:24:03 -05:00 committed by GitHub
commit 169b8747d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
} }