MCPcopy
hub / github.com/evilsocket/opensnitch / doCleanup

Function doCleanup

daemon/main.go:371–398  ·  view source on GitHub ↗
(queue, repeatQueue *netfilter.Queue)

Source from the content-addressed store, hash-verified

369}
370
371func doCleanup(queue, repeatQueue *netfilter.Queue) {
372 log.Info("Cleaning up ...")
373 firewall.Stop()
374 monitor.End()
375 uiClient.Close()
376 if resolvMonitor != nil {
377 resolvMonitor.Close()
378 }
379
380 if cpuProfile != "" {
381 pprof.StopCPUProfile()
382 }
383
384 if memProfile != "" {
385 runtime.GC() // get up-to-date statistics
386 if err := pprof.WriteHeapProfile(memFile); err != nil {
387 log.Error("Could not write memory profile: %s", err)
388 }
389 log.Info("Writing mem profile to %s", memProfile)
390 memFile.Close()
391 }
392 if traceFile != "" {
393 trace.Stop()
394 }
395
396 repeatQueue.Close()
397 queue.Close()
398}
399
400func onPacket(packet netfilter.Packet) {
401 // DNS response, just parse, track and accept.

Callers 1

mainFunction · 0.85

Calls 2

StopMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected