re-enable session workers in a way that doesn't block and drops packets before decrypting if necessary

This commit is contained in:
Arceliar 2019-02-28 20:05:21 -06:00
parent 06df791efc
commit 304f22dc1d
2 changed files with 24 additions and 15 deletions

View file

@ -66,7 +66,7 @@ func (r *router) init(core *Core) {
r.reconfigure = make(chan chan error, 1)
r.addr = *address.AddrForNodeID(&r.core.dht.nodeID)
r.subnet = *address.SubnetForNodeID(&r.core.dht.nodeID)
in := make(chan []byte, 32) // TODO something better than this...
in := make(chan []byte, 1) // TODO something better than this...
p := r.core.peers.newPeer(&r.core.boxPub, &r.core.sigPub, &crypto.BoxSharedKey{}, "(self)", nil)
p.out = func(packet []byte) { in <- packet }
r.in = in
@ -322,9 +322,6 @@ func (r *router) sendPacket(bs []byte) {
// Don't continue - drop the packet
return
}
sinfo.doSend(bs)
return
sinfo.send <- bs
}
}
@ -404,8 +401,6 @@ func (r *router) handleTraffic(packet []byte) {
if !isIn {
return
}
sinfo.doRecv(&p)
return
sinfo.recv <- &p
}