diff mbox series

[v2] service: Leverage 'connman_service_set_proxy_method'.

Message ID 20231116045908.638483-1-gerickson@nuovations.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [v2] service: Leverage 'connman_service_set_proxy_method'. | expand

Commit Message

Grant Erickson Nov. 16, 2023, 4:59 a.m. UTC
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(-)

Comments

Marcel Holtmann Nov. 23, 2023, 11:22 a.m. UTC | #1
Hi Grant,

> 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(-)

patch has been applied.

Regards

Marcel
diff mbox series

Patch

diff --git a/src/service.c b/src/service.c
index 81a1bebdc14b..ac6d8665ccf4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -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;
 	}