Skip to content

Commit

Permalink
quit on interrupted sleep
Browse files Browse the repository at this point in the history
Quit openconnect if sleep was interrupted by signal(e.g. ^C).

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Wu, Fengguang authored and David Woodhouse committed Dec 12, 2008
1 parent 13aad61 commit 097adf4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cstp.c
Expand Up @@ -338,6 +338,8 @@ static int cstp_reconnect(struct openconnect_info *vpninfo)
"sleep %ds, remain timeout %ds\n",
interval, timeout);
sleep(interval);
if (killed)
return 1;
timeout -= interval;
interval += vpninfo->reconnect_interval;
if (interval > RECONNECT_INTERVAL_MAX)
Expand Down
2 changes: 1 addition & 1 deletion mainloop.c
Expand Up @@ -55,7 +55,7 @@ int queue_new_packet(struct pkt **q, int type, void *buf, int len)
return 0;
}

static int killed;
int killed;

static void handle_sigint(int sig)
{
Expand Down
2 changes: 2 additions & 0 deletions openconnect.h
Expand Up @@ -213,6 +213,8 @@ void queue_packet(struct pkt **q, struct pkt *new);
int keepalive_action(struct keepalive_info *ka, int *timeout);
int ka_stalled_dpd_time(struct keepalive_info *ka, int *timeout);

extern int killed;

/* xml.c */
int config_lookup_host(struct openconnect_info *vpninfo, const char *host);

Expand Down

0 comments on commit 097adf4

Please sign in to comment.