Browse Source

close trace file if needed

pull/315/head
switch_st 4 years ago
parent
commit
8a1bcf0fa6
  1. 1
      include/n2n.h
  2. 2
      src/edge_utils.c
  3. 6
      src/n2n.c

1
include/n2n.h

@ -398,6 +398,7 @@ void setTraceLevel(int level);
void setUseSyslog(int use_syslog); void setUseSyslog(int use_syslog);
void setTraceFile(FILE *f); void setTraceFile(FILE *f);
int getTraceLevel(); int getTraceLevel();
void closeTraceFile();
void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...); void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...);
/* Tuntap API */ /* Tuntap API */

2
src/edge_utils.c

@ -1982,6 +1982,8 @@ void edge_term(n2n_edge_t * eee) {
edge_cleanup_routes(eee); edge_cleanup_routes(eee);
closeTraceFile();
free(eee); free(eee);
} }

6
src/n2n.c

@ -82,6 +82,12 @@ void setTraceFile(FILE *f) {
traceFile = f; traceFile = f;
} }
void closeTraceFile() {
if (traceFile != NULL && traceFile != stdout) {
fclose(traceFile);
}
}
#define N2N_TRACE_DATESIZE 32 #define N2N_TRACE_DATESIZE 32
void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...) { void traceEvent(int eventTraceLevel, char* file, int line, char * format, ...) {
va_list va_ap; va_list va_ap;

Loading…
Cancel
Save