Skip to content

Commit

Permalink
call run_tunnel from a single place
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbaseman committed Oct 19, 2017
1 parent ca1fd53 commit 41cf497
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,15 @@ int main(int argc, char **argv)
log_warn("This process was not spawned with root "
"privileges, this will probably not work.\n");

if (run_tunnel(&cfg) == 0)
ret = EXIT_SUCCESS;
while ((ret == EXIT_SUCCESS) && (cfg.loop!=0) && (get_sig_received()==0)) {
sleep(cfg.loop);
if (run_tunnel(&cfg) != 0)
do {
if (run_tunnel(&cfg) != 0) {
ret = EXIT_FAILURE;
}
} else
ret = EXIT_SUCCESS;
if ((cfg.loop > 0) && (get_sig_received() == 0))
sleep(cfg.loop);
} while ((get_sig_received() == 0) && (cfg.loop !=0));

goto exit;

user_error:
Expand Down

0 comments on commit 41cf497

Please sign in to comment.