start migrating tunConn to the actor model

This commit is contained in:
Arceliar 2019-08-24 11:38:47 -05:00
parent b582c444f8
commit 4893a07696
3 changed files with 192 additions and 4 deletions

View file

@ -257,8 +257,13 @@ func (tun *TunAdapter) wrap(conn *yggdrasil.Conn) (c *tunConn, err error) {
tun.addrToConn[s.addr] = &s
tun.subnetToConn[s.snet] = &s
// Start the connection goroutines
go s.reader()
go s.writer()
conn.SetReadCallback(func(bs []byte) {
s.EnqueueFrom(conn, func() {
s._read(bs)
})
})
//go s.reader()
//go s.writer()
go s.checkForTimeouts()
// Return
return c, err