mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 12:05:23 +00:00
I think this fixes the concurrent map read/write panic
This commit is contained in:
parent
e88bef35c0
commit
784acba823
@ -64,9 +64,11 @@ func (c *Conn) String() string {
|
|||||||
return fmt.Sprintf("conn=%p", c)
|
return fmt.Sprintf("conn=%p", c)
|
||||||
}
|
}
|
||||||
|
|
||||||
// This should only be called from the router goroutine
|
// This should never be called from the router goroutine
|
||||||
func (c *Conn) search() error {
|
func (c *Conn) search() error {
|
||||||
sinfo, isIn := c.core.searches.searches[*c.nodeID]
|
var sinfo *searchInfo
|
||||||
|
var isIn bool
|
||||||
|
c.core.router.doAdmin(func() { sinfo, isIn = c.core.searches.searches[*c.nodeID] })
|
||||||
if !isIn {
|
if !isIn {
|
||||||
done := make(chan struct{}, 1)
|
done := make(chan struct{}, 1)
|
||||||
var sess *sessionInfo
|
var sess *sessionInfo
|
||||||
@ -80,8 +82,10 @@ func (c *Conn) search() error {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sinfo = c.core.searches.newIterSearch(c.nodeID, c.nodeMask, searchCompleted)
|
c.core.router.doAdmin(func() {
|
||||||
sinfo.continueSearch()
|
sinfo = c.core.searches.newIterSearch(c.nodeID, c.nodeMask, searchCompleted)
|
||||||
|
sinfo.continueSearch()
|
||||||
|
})
|
||||||
<-done
|
<-done
|
||||||
c.session = sess
|
c.session = sess
|
||||||
if c.session == nil && err == nil {
|
if c.session == nil && err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user