We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 03c5a0c commit a4cb23aCopy full SHA for a4cb23a
tun/netstack/tun.go
@@ -166,7 +166,7 @@ func (tun *netTun) WriteNotify() {
166
}
167
168
func (tun *netTun) Close() error {
169
- tun.stack.RemoveNIC(1)
+ tun.stack.Destroy()
170
171
if tun.events != nil {
172
close(tun.events)
@@ -175,6 +175,8 @@ func (tun *netTun) Close() error {
175
tun.ep.Close()
176
177
if tun.incomingPacket != nil {
178
+ // It's safe to close the channel here because tun.stack.Destroy() ensures that no worker
179
+ // goroutines could be calling WriteNotify()
180
close(tun.incomingPacket)
181
182
0 commit comments