Discussion:
[PATCH] Clear the Error property
(too old to reply)
Naveen Singh
2015-10-23 05:30:34 UTC
Permalink
From: nasingh <***@nasingh-vm.roam.corp.google.com>

It is been seen that if the service state has transitioned to failure
there is no way for it to get it back to idle. This fix allows the
state to be transitioned back to idle as part of handling clear_property
handler for error event.
Refer Patrik's commit 251d95755dd144c8bd6d3e3bd5d6a47f891f938f which
fixes the documentation for transitioning out of failure state.
---
src/service.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/service.c b/src/service.c
index 02a6844..dfeac1b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3532,6 +3532,7 @@ static DBusMessage *clear_property(DBusConnection *conn,

g_get_current_time(&service->modified);
service_save(service);
+ __connman_service_clear_error(service);
} else
return __connman_error_invalid_property(msg);
--
2.6.0.rc2.230.g3dd15c0
Patrik Flykt
2015-10-23 10:51:56 UTC
Permalink
Hi,
Post by Naveen Singh
It is been seen that if the service state has transitioned to failure
there is no way for it to get it back to idle. This fix allows the
state to be transitioned back to idle as part of handling clear_property
handler for error event.
Refer Patrik's commit 251d95755dd144c8bd6d3e3bd5d6a47f891f938f which
fixes the documentation for transitioning out of failure state.
---
src/service.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/service.c b/src/service.c
index 02a6844..dfeac1b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3532,6 +3532,7 @@ static DBusMessage *clear_property(DBusConnection *conn,
g_get_current_time(&service->modified);
service_save(service);
+ __connman_service_clear_error(service);
__connman_service_clear_error() is the right choice here. But one needs
to be careful when using that function, it resets the service state to
idle, but does not inform any pending clients what happened. In the two
cases it is used, ConnMan is starting to connect the service in
__connman_service_connect() and not asked to retry when the Agent
replies in report_error_cb().

So after calling __connman_service_clear_error() one needs to call
service_complete() as well to inform any pending clients that the
operation was interrupted. This because the service will be in the
middle of a connect for example. service_complete() does already
g_get_current_time() and service_save(), so those two lines shall be
removed as well from this code in clear_property().
Post by Naveen Singh
} else
return __connman_error_invalid_property(msg);
Thanks!

Patrik

Loading...