mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03: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:
parent
436c84ca33
commit
533da351f9
7 changed files with 132 additions and 17 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue