Skip to contentSkip to conversation

service: Leverage 'connman_service_set_proxy_method'.

PATCH Superseded Grant Erickson 2 participants 3 messages Nov 16, 2023 – Nov 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 service: Leverage 'connman_service_set_proxy_method'.

Previously, inside 'check_proxy_method', if WPAD failed for any reason the code would explicitly manipulate the 'proxy' field of the service object and then invoke '__connman_notifier_proxy_changed'.

However, when 'method' is 'CONNMAN_SERVICE_PROXY_METHOD_DIRECT', which is the case in 'check_proxy_method', this is 2/3 of what 'connman_service_set_proxy_method' already does. The 1/3 difference is that 'connman_service_set_proxy_method' calls 'proxy_changed'.

Consequently, since there does not seem to be a well-documented or compelling reason to avoid the call to 'proxy_changed', simply leverage and call 'connman_service_set_proxy_method' from 'check_proxy_method' to set the service proxy method to 'CONNMAN_SERVICE_PROXY_METHOD_DIRECT' when WPAD fails.

---
 src/service.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
src/service.c +1 -2
index 81a1bebdc14b..b3e45c95de46 100644
@@ -1470,8 +1470,7 @@ static bool check_proxy_setup(struct connman_service *service)
 		return true;
 
 	if (__connman_wpad_start(service) < 0) {
-		service->proxy = CONNMAN_SERVICE_PROXY_METHOD_DIRECT;
-		__connman_notifier_proxy_changed(service);
+		connman_service_set_proxy_method(service, CONNMAN_SERVICE_PROXY_METHOD_DIRECT);
 		return true;
 	}
 
Signature · 1 line
2.42.0
#1 lore raw

PATCH v2 1/1 service: Leverage 'connman_service_set_proxy_method'.

Previously, inside 'check_proxy_method', if WPAD failed for any reason the code would explicitly manipulate the 'proxy' field of the service object and then invoke '__connman_notifier_proxy_changed'.

However, when 'method' is 'CONNMAN_SERVICE_PROXY_METHOD_DIRECT', which is the case in 'check_proxy_method', this is 2/3 of what 'connman_service_set_proxy_method' already does. The 1/3 difference is that 'connman_service_set_proxy_method' calls 'proxy_changed'.

Consequently, since there does not seem to be a well-documented or compelling reason to avoid the call to 'proxy_changed', simply leverage and call 'connman_service_set_proxy_method' from 'check_proxy_method' to set the service proxy method to 'CONNMAN_SERVICE_PROXY_METHOD_DIRECT' when WPAD fails.

---
 src/service.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/service.c +2 -2
index 81a1bebdc14b..ac6d8665ccf4 100644
@@ -1470,8 +1470,8 @@ static bool check_proxy_setup(struct connman_service *service)
 		return true;
 
 	if (__connman_wpad_start(service) < 0) {
-		service->proxy = CONNMAN_SERVICE_PROXY_METHOD_DIRECT;
-		__connman_notifier_proxy_changed(service);
+		connman_service_set_proxy_method(service,
+			CONNMAN_SERVICE_PROXY_METHOD_DIRECT);
 		return true;
 	}
 
Signature · 1 line
2.42.0
#2 lore raw

Hi Grant,

Quoted 9 lines

Previously, inside 'check_proxy_method', if WPAD failed for any reason the code would explicitly manipulate the 'proxy' field of the service object and then invoke '__connman_notifier_proxy_changed'.

However, when 'method' is 'CONNMAN_SERVICE_PROXY_METHOD_DIRECT', which is the case in 'check_proxy_method', this is 2/3 of what 'connman_service_set_proxy_method' already does. The 1/3 difference is that 'connman_service_set_proxy_method' calls 'proxy_changed'.

Quoted 8 lines

Consequently, since there does not seem to be a well-documented or compelling reason to avoid the call to 'proxy_changed', simply leverage and call 'connman_service_set_proxy_method' from 'check_proxy_method' to set the service proxy method to 'CONNMAN_SERVICE_PROXY_METHOD_DIRECT' when WPAD fails.
---
src/service.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

patch has been applied.

Regards

Marcel