Ejemplo n.º 1
0
void uninit_flow(struct flow *flow)
{
	DEBUG_MSG(LOG_DEBUG,"uninit_flow() called for flow %d",flow->id);
	if (flow->fd != -1)
		close(flow->fd);
	if (flow->listenfd_data != -1)
		close(flow->listenfd_data);
#ifdef HAVE_LIBPCAP
	int rc;
	if (flow->settings.traffic_dump && flow->pcap_thread) {
		rc = pthread_cancel(flow->pcap_thread);
		if (rc)
			logging(LOG_WARNING, "failed to cancel dump thread: %s",
				strerror(rc));

		/* wait for the dump thread to react to the cancellation request */
		rc = pthread_join(flow->pcap_thread, NULL);
		if (rc)
			logging(LOG_WARNING, "failed to join dump thread: %s",
				strerror(rc));
	}
#endif /* HAVE_LIBPCAP */
	free_all(flow->read_block, flow->write_block, flow->addr, flow->error);
	free_math_functions(flow);
}
Ejemplo n.º 2
0
void uninit_flow(struct _flow *flow)
{
	DEBUG_MSG(LOG_DEBUG,"uninit_flow() called for flow %d",flow->id);
	if (flow->fd != -1)
		close(flow->fd);
	if (flow->listenfd_data != -1)
		close(flow->listenfd_data);
#ifdef HAVE_LIBPCAP
	int rc;
	if (flow->settings.traffic_dump && flow->pcap_thread) {
		rc = pthread_cancel(flow->pcap_thread);
		if (rc)
			logging_log(LOG_WARNING, "failed to cancel dump "
				    "thread: %s", strerror(errno));
		fg_pcap_cleanup(flow);
	}
#endif
	free_all(flow->read_block, flow->write_block, flow->addr, flow->error);
	free_math_functions(flow);
}