Fix leaks and add test

This commit is contained in:
世界
2022-09-23 13:14:31 +08:00
parent 9856b73cb5
commit 407509c985
19 changed files with 167 additions and 59 deletions

View File

@@ -106,5 +106,11 @@ func (w *SystemDevice) Events() chan wgTun.Event {
}
func (w *SystemDevice) Close() error {
select {
case <-w.events:
return os.ErrClosed
default:
close(w.events)
}
return w.device.Close()
}