4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-07-09 14:34:06 +00:00

start migrating the TunAdapter to the actor model

This commit is contained in:
Arceliar
2019-08-25 18:08:43 -05:00
parent 502f2937a9
commit aaf34c6304
3 changed files with 267 additions and 250 deletions

View File

@ -113,8 +113,7 @@ func (s *tunConn) _read(bs []byte) (err error) {
util.PutBytes(bs)
return
}
// FIXME this send can block if the tuntap isn't running, which isn't really safe...
s.tun.send <- bs
s.tun.writer.writeFrom(s, bs)
s.stillAlive()
return
}
@ -208,7 +207,7 @@ func (s *tunConn) _write(bs []byte) (err error) {
Data: bs[:900],
}
if packet, err := CreateICMPv6(bs[8:24], bs[24:40], ipv6.ICMPTypePacketTooBig, 0, ptb); err == nil {
s.tun.send <- packet
s.tun.writer.writeFrom(s, packet)
}
} else {
if e.Closed() {