diff mbox series

[v2,05/60] service: Change return type of 'start_wispr_if_connected'.

Message ID 20231221064007.2347566-6-gerickson@nuovations.com (mailing list archive)
State Superseded
Headers show
Series Complete 'continuous' Online Check Mode Implementation. | expand

Commit Message

Grant Erickson Dec. 21, 2023, 6:39 a.m. UTC
This changes the return type of 'start_wispr_if_connected' from 'void'
to 'int' to allow callers to conditionally handle its return status.
---
 src/service.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/service.c b/src/service.c
index 0c8a4bc0a0c9..5077e3fb2d1a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2394,15 +2394,23 @@  static void complete_online_check(struct connman_service *service,
  *                       reachability probes if the IPv4 or IPv6 state
  *                       is "connected" (that is, "ready" or "online").
  *
+ *  @retval  0          If successful.
+ *  @retval  -EINVAL    If @a service is null or @a type is invalid.
+ *  @retval  -EPERM     If online checks are disabled via
+ *                      configuration.
+ *
  */
-static void start_wispr_if_connected(struct connman_service *service)
+static int start_wispr_if_connected(struct connman_service *service)
 {
 	DBG("service %p (%s) maybe start WISPr",
 		service,
 		connman_service_get_identifier(service));
 
+	if (!service)
+		return -EINVAL;
+
 	if (!online_check_is_enabled_check(service))
-		return;
+		return -EPERM;
 
 	if (__connman_service_is_connected_state(service,
 			CONNMAN_IPCONFIG_TYPE_IPV4))
@@ -2413,6 +2421,8 @@  static void start_wispr_if_connected(struct connman_service *service)
 			CONNMAN_IPCONFIG_TYPE_IPV6))
 		__connman_service_wispr_start(service,
 					CONNMAN_IPCONFIG_TYPE_IPV6);
+
+	return 0;
 }
 
 /**