MCPcopy
hub / github.com/google/gopacket / Close

Method Close

pcap/pcap.go:378–393  ·  view source on GitHub ↗

Close closes the underlying pcap handle.

()

Source from the content-addressed store, hash-verified

376
377// Close closes the underlying pcap handle.
378func (p *Handle) Close() {
379 p.closeMu.Lock()
380 defer p.closeMu.Unlock()
381
382 if !p.isOpen() {
383 return
384 }
385
386 atomic.StoreUint64(&p.stop, 1)
387
388 // wait for packet reader to stop
389 p.mu.Lock()
390 defer p.mu.Unlock()
391
392 p.pcapClose()
393}
394
395// Error returns the current error associated with a pcap handle (pcap_geterr).
396func (p *Handle) Error() error {

Callers 13

tryCaptureFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.45
CompileBPFFilterFunction · 0.45
NewBPFFunction · 0.45
TestPCAPGoWriteFunction · 0.45
mainFunction · 0.45
TestPcapFileReadFunction · 0.45
generatePacketsFunction · 0.45
TestPCAPGoNgWriteFunction · 0.45
mainFunction · 0.45

Calls 2

isOpenMethod · 0.95
pcapCloseMethod · 0.95

Tested by 3

TestPCAPGoWriteFunction · 0.36
TestPcapFileReadFunction · 0.36
TestPCAPGoNgWriteFunction · 0.36