mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-10 15:30:34 +03:00
Pointer receivers for phony.Block
This commit is contained in:
parent
5d7d84f827
commit
607c906820
@ -178,7 +178,7 @@ func (c *Core) GetDHT() []DHTEntry {
|
|||||||
dhtentries = append(dhtentries, info)
|
dhtentries = append(dhtentries, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
phony.Block(c.router, getDHT)
|
phony.Block(&c.router, getDHT)
|
||||||
return dhtentries
|
return dhtentries
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ func (c *Core) GetSwitchQueues() SwitchQueues {
|
|||||||
switchqueues.Queues = append(switchqueues.Queues, queue)
|
switchqueues.Queues = append(switchqueues.Queues, queue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
phony.Block(c.switchTable, getSwitchQueues)
|
phony.Block(&c.switchTable, getSwitchQueues)
|
||||||
return switchqueues
|
return switchqueues
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ func (c *Core) GetSessions() []Session {
|
|||||||
sessions = append(sessions, session)
|
sessions = append(sessions, session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
phony.Block(c.router, getSessions)
|
phony.Block(&c.router, getSessions)
|
||||||
return sessions
|
return sessions
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ func (c *Core) GetNodeInfo(key crypto.BoxPubKey, coords []uint64, nocache bool)
|
|||||||
})
|
})
|
||||||
c.router.nodeinfo.sendNodeInfo(key, wire_coordsUint64stoBytes(coords), false)
|
c.router.nodeinfo.sendNodeInfo(key, wire_coordsUint64stoBytes(coords), false)
|
||||||
}
|
}
|
||||||
phony.Block(c.router, sendNodeInfoRequest)
|
phony.Block(&c.router, sendNodeInfoRequest)
|
||||||
timer := time.AfterFunc(6*time.Second, func() { close(response) })
|
timer := time.AfterFunc(6*time.Second, func() { close(response) })
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
for res := range response {
|
for res := range response {
|
||||||
@ -454,7 +454,7 @@ func (c *Core) DHTPing(key crypto.BoxPubKey, coords []uint64, target *crypto.Nod
|
|||||||
})
|
})
|
||||||
c.router.dht.ping(&info, &rq.dest)
|
c.router.dht.ping(&info, &rq.dest)
|
||||||
}
|
}
|
||||||
phony.Block(c.router, sendPing)
|
phony.Block(&c.router, sendPing)
|
||||||
// TODO: do something better than the below...
|
// TODO: do something better than the below...
|
||||||
res := <-resCh
|
res := <-resCh
|
||||||
if res != nil {
|
if res != nil {
|
||||||
|
@ -92,7 +92,7 @@ func (c *Conn) setMTU(from phony.Actor, mtu uint16) {
|
|||||||
func (c *Conn) search() error {
|
func (c *Conn) search() error {
|
||||||
var sinfo *searchInfo
|
var sinfo *searchInfo
|
||||||
var isIn bool
|
var isIn bool
|
||||||
phony.Block(c.core.router, func() {
|
phony.Block(&c.core.router, func() {
|
||||||
sinfo, isIn = c.core.router.searches.searches[*c.nodeID]
|
sinfo, isIn = c.core.router.searches.searches[*c.nodeID]
|
||||||
})
|
})
|
||||||
if !isIn {
|
if !isIn {
|
||||||
@ -108,7 +108,7 @@ func (c *Conn) search() error {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
phony.Block(c.core.router, func() {
|
phony.Block(&c.core.router, func() {
|
||||||
sinfo = c.core.router.searches.newIterSearch(c.nodeID, c.nodeMask, searchCompleted)
|
sinfo = c.core.router.searches.newIterSearch(c.nodeID, c.nodeMask, searchCompleted)
|
||||||
sinfo.continueSearch()
|
sinfo.continueSearch()
|
||||||
})
|
})
|
||||||
|
@ -176,7 +176,7 @@ func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) (*config.NodeState,
|
|||||||
|
|
||||||
c.config.Mutex.RLock()
|
c.config.Mutex.RLock()
|
||||||
if c.config.Current.SwitchOptions.MaxTotalQueueSize >= SwitchQueueTotalMinSize {
|
if c.config.Current.SwitchOptions.MaxTotalQueueSize >= SwitchQueueTotalMinSize {
|
||||||
phony.Block(c.switchTable, func() {
|
phony.Block(&c.switchTable, func() {
|
||||||
c.switchTable.queues.totalMaxSize = c.config.Current.SwitchOptions.MaxTotalQueueSize
|
c.switchTable.queues.totalMaxSize = c.config.Current.SwitchOptions.MaxTotalQueueSize
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ func (ps *peers) removePeer(port switchPort) {
|
|||||||
if port == 0 {
|
if port == 0 {
|
||||||
return
|
return
|
||||||
} // Can't remove self peer
|
} // Can't remove self peer
|
||||||
phony.Block(ps.core.router, func() {
|
phony.Block(&ps.core.router, func() {
|
||||||
ps.core.switchTable.forgetPeer(port)
|
ps.core.switchTable.forgetPeer(port)
|
||||||
})
|
})
|
||||||
ps.mutex.Lock()
|
ps.mutex.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user