5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 13:00:47 +00:00

Bug fixes for AWDL

This commit is contained in:
Neil Alexander 2019-01-23 18:16:31 +00:00
parent 2944be4faf
commit 188a9e439d
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -25,18 +25,18 @@ type awdlReadWriteCloser struct {
}
func (c awdlReadWriteCloser) Read(p []byte) (n int, err error) {
select {
case packet := <-c.fromAWDL:
if packet, ok := <-c.fromAWDL; ok {
n = copy(p, packet)
return n, nil
default:
return 0, io.EOF
}
return 0, io.EOF
}
func (c awdlReadWriteCloser) Write(p []byte) (n int, err error) {
c.toAWDL <- p
return len(p), nil
var pc []byte
pc = append(pc, p...)
c.toAWDL <- pc
return len(pc), nil
}
func (c awdlReadWriteCloser) Close() error {