void cleanup_exit(int ret){ cleanup_ssl(); zshare_pid_delete(); exit(ret); }
// Deallocate dynamic structures, close socket, // and free State object itself. // Please add cleanup code here if you extend // the structure! void StateCleanup(struct telex_state **_state) { if (!_state || !_state) return; struct telex_state *state = *_state; *_state = NULL; if (state->local) { _dec(BEV, state->local); bufferevent_free(state->local); state->local = NULL; } cleanup_ssl(state); // TODO: Do we have to close the sockets? state->conf->count_open_tunnels--; unsigned long long duration = time_ms() - state->start_ms; LogInfo(state->name, "Closed (%u active); %ld up %ld down %0.3f s", state->conf->count_open_tunnels, state->in_local, state->in_remote, duration/1000.); _dec(STATE, state); free(state); }