// Close the NfLog down func (nflog *NfLog) Close() { if *Debug { log.Printf("Unbinding this socket (%d) from group %d", nflog.fd, nflog.McastGroup) } nflog.quit = true if C.nflog_unbind_group(nflog.gh) < 0 { log.Printf("nflog_unbind_group(%d) failed: %s", nflog.McastGroup, strerror()) } if *Debug { log.Printf("Closing nflog") } if C.nflog_close(nflog.h) < 0 { log.Printf("nflog_close failed: %s", strerror()) } }
// Close the NfLog down func (nflog *NfLog) Close() { close(nflog.quit) // Sometimes hangs and doesn't seem to be necessary // if *Verbose { // log.Printf("Unbinding socket %d from group %d", nflog.fd, nflog.McastGroup) // } // if rc, err := C.nflog_unbind_group(nflog.gh); rc < 0 || err != nil { // log.Printf("nflog_unbind_group(%d) failed: %s", nflog.McastGroup, nflogError(err)) // } if *Verbose { log.Printf("Closing nflog socket %d group %d", nflog.fd, nflog.McastGroup) } if rc, err := C.nflog_close(nflog.h); rc < 0 || err != nil { log.Printf("nflog_close failed: %s", nflogError(nil)) } // Mark this index as no longer in use nflogs[nflog.index] = nil C.free(unsafe.Pointer(nflog.packets)) }