mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-07-03 08:27:47 +00:00
fix actor EnqueueFrom stack overflow (use nil now to send from self) and replace session send/recv workers with actor functions
This commit is contained in:
@ -66,7 +66,7 @@ func (r *router) init(core *Core) {
|
||||
p := r.core.peers.newPeer(&r.core.boxPub, &r.core.sigPub, &crypto.BoxSharedKey{}, &self, nil)
|
||||
p.out = func(packets [][]byte) {
|
||||
// TODO make peers and/or the switch into actors, have them pass themselves as the from field
|
||||
r.handlePackets(r, packets)
|
||||
r.handlePackets(nil, packets)
|
||||
}
|
||||
r.out = p.handlePacket // TODO if the peer becomes its own actor, then send a message here
|
||||
r.nodeinfo.init(r.core)
|
||||
@ -160,6 +160,8 @@ func (r *router) _handleTraffic(packet []byte) {
|
||||
util.PutBytes(p.Payload)
|
||||
return
|
||||
}
|
||||
sinfo.recv(r, &p)
|
||||
return
|
||||
select {
|
||||
case sinfo.fromRouter <- p:
|
||||
case <-sinfo.cancel.Finished():
|
||||
|
Reference in New Issue
Block a user