MCPcopy Create free account
hub / github.com/SamNet-dev/snix / Close

Method Close

platform/windows/backend.go:190–214  ·  view source on GitHub ↗

Close tears down the WinDivert handle and stops the recv loop.

()

Source from the content-addressed store, hash-verified

188
189// Close tears down the WinDivert handle and stops the recv loop.
190func (b *Backend) Close() error {
191 b.mu.Lock()
192 if !b.opened {
193 b.mu.Unlock()
194 return nil
195 }
196 b.opened = false
197 select {
198 case <-b.closed:
199 default:
200 close(b.closed)
201 }
202 h := b.handle
203 b.handle = invalidHandle
204 b.mu.Unlock()
205
206 var firstErr error
207 if h != invalidHandle {
208 if err := Close(h); err != nil {
209 firstErr = err
210 }
211 }
212 b.reader.Wait()
213 return firstErr
214}

Callers

nothing calls this directly

Implementers 3

fakeBackendcore/engine/engine_test.go
Backendplatform/windows/backend.go
Backendplatform/linux/nfqueue.go

Calls 2

closeFunction · 0.85
CloseFunction · 0.85

Tested by

no test coverage detected