On Mon, Nov 9, 2015 at 3:56 PM, Gert Doering <g...@greenie.muc.de> wrote:
> On Mon, Nov 09, 2015 at 03:35:23PM -0500, Selva Nair wrote:
>> Requires the installer to update the registry during an upgrade of exisitng
>> installations, or notify the end user of the change in the default value of
>> disconnect_on_suspend (0).
>
> What does this patch *do*?  Is this the "set up registry key on first
> start" part (so we set the default differently now)?
>
> But that implies that an upgrade will not change the default, right?

On further thought, its better to go more bold on this. 
Here is version 2 which culls the suspend processing.

--8<--

Signed-off-by: Selva Nair <selva.n...@gmail.com>
---
 main.c     | 14 +-------------
 registry.c |  3 ---
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/main.c b/main.c
index 08c5663..bc3c41c 100644
--- a/main.c
+++ b/main.c
@@ -399,19 +399,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, 
WPARAM wParam, LPARAM
     case WM_POWERBROADCAST:
       switch (wParam) {
         case PBT_APMSUSPEND:
-          if (o.disconnect_on_suspend[0] == '1')
-            {
-              /* Suspend running connections */
-              for (i=0; i<o.num_configs; i++)
-                {
-                  if (o.conn[i].state == connected)
-                SuspendOpenVPN(i);
-                }
-
-              /* Wait for all connections to suspend */
-              for (i=0; i<10; i++, Sleep(500))
-                if (CountConnState(suspending) == 0) break;
-            }
+           /* do nothing */
           return FALSE;

         case PBT_APMRESUMESUSPEND:
diff --git a/registry.c b/registry.c
index f96827a..2a75738 100644
--- a/registry.c
+++ b/registry.c
@@ -111,9 +111,6 @@ GetRegistryKeys()

   if (!GetRegKey(_T("show_script_window"), o.show_script_window, _T("1"), 
_countof(o.show_script_window))) return(false);

-  if (!GetRegKey(_T("disconnect_on_suspend"), o.disconnect_on_suspend, 
_T("1"), 
-      _countof(o.disconnect_on_suspend))) return(false);
-
   if (!GetRegKey(_T("passphrase_attempts"), o.psw_attempts_string, _T("3"), 
       _countof(o.psw_attempts_string))) return(false);
   o.psw_attempts = _ttoi(o.psw_attempts_string);
-- 
2.6.2


Reply via email to