Rescan configs even when connections are active

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/47/head
Selva Nair 2016-05-13 23:35:09 -04:00
parent 38541f3693
commit 284a4e27e3
2 changed files with 13 additions and 11 deletions

View File

@ -217,7 +217,13 @@ BuildFileList()
{
static bool issue_warnings = true;
o.num_configs = 0;
/*
* If no connections are active reset num_configs and rescan
* to make a new list. Else we keep all current configs and
* rescan to add any new one's found
*/
if (CountConnState(disconnected) == o.num_configs)
o.num_configs = 0;
BuildFileList0 (o.config_dir, issue_warnings);

16
tray.c
View File

@ -182,8 +182,7 @@ OnNotifyTray(LPARAM lParam)
case WM_RBUTTONUP:
/* Recreate popup menus */
DestroyPopupMenus();
if (CountConnState(disconnected) == o.num_configs)
BuildFileList();
BuildFileList();
CreatePopupMenus();
GetCursorPos(&pt);
@ -206,16 +205,13 @@ OnNotifyTray(LPARAM lParam)
else {
int disconnected_conns = CountConnState(disconnected);
if (disconnected_conns == o.num_configs) {
/* Reread configs and recreate menus if no connection is running */
DestroyPopupMenus();
BuildFileList();
CreatePopupMenus();
DestroyPopupMenus();
BuildFileList();
CreatePopupMenus();
/* Start connection if only one config exist */
if (o.num_configs == 1 && o.conn[0].state == disconnected)
/* Start connection if only one config exist */
if (o.num_configs == 1 && o.conn[0].state == disconnected)
StartOpenVPN(&o.conn[0]);
}
else if (disconnected_conns == o.num_configs - 1) {
/* Show status window if only one connection is running */
int i;