From 6187ca379f38748fe5bbb00d9e5ec1d74c941baf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 24 Jun 2018 19:18:29 +0300 Subject: code simplification --- plugins/ProxySwitch/src/ip.cpp | 15 +++++++-------- plugins/ProxySwitch/src/main.cpp | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/ProxySwitch/src/ip.cpp b/plugins/ProxySwitch/src/ip.cpp index 87c5962433..f421f23ec2 100644 --- a/plugins/ProxySwitch/src/ip.cpp +++ b/plugins/ProxySwitch/src/ip.cpp @@ -631,15 +631,14 @@ int ManageConnections(WPARAM wParam, LPARAM) break; } - if ((pFound && info->connected) || (!pFound && !info->connected)) - return 0; - - if (!pFound) + if (!pFound && info->connected) { g_arConnections.insert(new ACTIVE_CONNECTION(info->local.sin_addr.s_addr, info->local.sin_port)); - else - g_arConnections.remove(g_arConnections.indexOf(&pFound)); - - SetEvent(hEventRebound); + SetEvent(hEventRebound); + } + else if (pFound && !info->connected) { + g_arConnections.remove(pFound); + SetEvent(hEventRebound); + } return 0; } diff --git a/plugins/ProxySwitch/src/main.cpp b/plugins/ProxySwitch/src/main.cpp index 3b4f8f89a8..50b280a77b 100644 --- a/plugins/ProxySwitch/src/main.cpp +++ b/plugins/ProxySwitch/src/main.cpp @@ -29,7 +29,7 @@ CMPlugin::CMPlugin() : HGENMENU hEnableDisablePopupMenu = 0; -OBJLIST g_arConnections(10); +OBJLIST g_arConnections(10, PtrKeySortT); mir_cs csConnection_List; OBJLIST g_arNIF(10); -- cgit v1.2.3