Discussion:
[PATCH v2 1/2] Clear the Error property
Naveen Singh
2015-10-27 03:41:09 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 | 74 +++++++++++++++++++++++++++++------------------------------
1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/service.c b/src/service.c
index 02a6844..e33284d 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3516,6 +3516,41 @@ static void set_error(struct connman_service *service,
DBUS_TYPE_STRING, &str);
}

+static void remove_timeout(struct connman_service *service)
+{
+ if (service->timeout > 0) {
+ g_source_remove(service->timeout);
+ service->timeout = 0;
+ }
+}
+
+static void reply_pending(struct connman_service *service, int error)
+{
+ remove_timeout(service);
+
+ if (service->pending) {
+ connman_dbus_reply_pending(service->pending, error, NULL);
+ service->pending = NULL;
+ }
+
+ if (service->provider_pending) {
+ connman_dbus_reply_pending(service->provider_pending,
+ error, service->path);
+ service->provider_pending = NULL;
+ }
+}
+
+static void service_complete(struct connman_service *service)
+{
+ reply_pending(service, EIO);
+
+ if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
+ __connman_service_auto_connect(service->connect_reason);
+
+ g_get_current_time(&service->modified);
+ service_save(service);
+}
+
static DBusMessage *clear_property(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
@@ -3530,8 +3565,8 @@ static DBusMessage *clear_property(DBusConnection *conn,
if (g_str_equal(name, "Error")) {
set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);

- g_get_current_time(&service->modified);
- service_save(service);
+ __connman_service_clear_error(service);
+ service_complete(service);
} else
return __connman_error_invalid_property(msg);

@@ -3849,30 +3884,6 @@ static void vpn_auto_connect(void)
g_timeout_add_seconds(0, run_vpn_auto_connect, NULL);
}

-static void remove_timeout(struct connman_service *service)
-{
- if (service->timeout > 0) {
- g_source_remove(service->timeout);
- service->timeout = 0;
- }
-}
-
-static void reply_pending(struct connman_service *service, int error)
-{
- remove_timeout(service);
-
- if (service->pending) {
- connman_dbus_reply_pending(service->pending, error, NULL);
- service->pending = NULL;
- }
-
- if (service->provider_pending) {
- connman_dbus_reply_pending(service->provider_pending,
- error, service->path);
- service->provider_pending = NULL;
- }
-}
-
bool
__connman_service_is_provider_pending(struct connman_service *service)
{
@@ -5032,17 +5043,6 @@ void __connman_service_set_search_domains(struct connman_service *service,
searchdomain_add_all(service);
}

-static void service_complete(struct connman_service *service)
-{
- reply_pending(service, EIO);
-
- if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
- __connman_service_auto_connect(service->connect_reason);
-
- g_get_current_time(&service->modified);
- service_save(service);
-}
-
static void report_error_cb(void *user_context, bool retry,
void *user_data)
{
--
2.6.0.rc2.230.g3dd15c0
Naveen Singh
2015-10-27 03:41:10 UTC
Permalink
From: nasingh <***@nasingh-vm.roam.corp.google.com>

Change the overview-api.txt to do the service transition from
failure state to idle.
---
doc/overview-api.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/overview-api.txt b/doc/overview-api.txt
index f126887..0a5996e 100644
--- a/doc/overview-api.txt
+++ b/doc/overview-api.txt
@@ -265,8 +265,8 @@ the "idle" state since the service is not connected.

+---------------+
| idle |<-------------------------------+
- +---------------+ |
- | |
+ +---------------+ A |
+ | clear error | |
| +-------------+ |
+----------------------| failure | |
| service.Connect() +-------------+ |
--
2.6.0.rc2.230.g3dd15c0
Patrik Flykt
2015-10-27 11:34:20 UTC
Permalink
Post by Naveen Singh
Change the overview-api.txt to do the service transition from
failure state to idle.
Applied, thanks!

Patrik

Naveen Singh
2015-10-27 03:46:58 UTC
Permalink
Hi Patrik
I had to move some functions in the file for the compilation to go through.
Regards
Naveen
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 | 74
+++++++++++++++++++++++++++++------------------------------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/src/service.c b/src/service.c
index 02a6844..e33284d 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3516,6 +3516,41 @@ static void set_error(struct connman_service *service,
DBUS_TYPE_STRING, &str);
}
+static void remove_timeout(struct connman_service *service)
+{
+ if (service->timeout > 0) {
+ g_source_remove(service->timeout);
+ service->timeout = 0;
+ }
+}
+
+static void reply_pending(struct connman_service *service, int error)
+{
+ remove_timeout(service);
+
+ if (service->pending) {
+ connman_dbus_reply_pending(service->pending, error, NULL);
+ service->pending = NULL;
+ }
+
+ if (service->provider_pending) {
+ connman_dbus_reply_pending(service->provider_pending,
+ error, service->path);
+ service->provider_pending = NULL;
+ }
+}
+
+static void service_complete(struct connman_service *service)
+{
+ reply_pending(service, EIO);
+
+ if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
+ __connman_service_auto_connect(service->connect_reason);
+
+ g_get_current_time(&service->modified);
+ service_save(service);
+}
+
static DBusMessage *clear_property(DBusConnection *conn,
Post by Naveen Singh
DBusMessage *msg, void *user_data)
{
@@ -3530,8 +3565,8 @@ static DBusMessage *clear_property(DBusConnection *conn,
if (g_str_equal(name, "Error")) {
set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN);
- g_get_current_time(&service->modified);
- service_save(service);
+ __connman_service_clear_error(service);
+ service_complete(service);
} else
return __connman_error_invalid_property(msg);
@@ -3849,30 +3884,6 @@ static void vpn_auto_connect(void)
g_timeout_add_seconds(0, run_vpn_auto_connect, NULL);
}
-static void remove_timeout(struct connman_service *service)
-{
- if (service->timeout > 0) {
- g_source_remove(service->timeout);
- service->timeout = 0;
- }
-}
-
-static void reply_pending(struct connman_service *service, int error)
-{
- remove_timeout(service);
-
- if (service->pending) {
- connman_dbus_reply_pending(service->pending, error, NULL);
- service->pending = NULL;
- }
-
- if (service->provider_pending) {
- connman_dbus_reply_pending(service->provider_pending,
- error, service->path);
- service->provider_pending = NULL;
- }
-}
-
bool
__connman_service_is_provider_pending(struct connman_service *service)
{
@@ -5032,17 +5043,6 @@ void __connman_service_set_search_domains(struct
connman_service *service,
searchdomain_add_all(service);
}
-static void service_complete(struct connman_service *service)
-{
- reply_pending(service, EIO);
-
- if (service->connect_reason != CONNMAN_SERVICE_CONNECT_REASON_USER)
- __connman_service_auto_connect(service->connect_reason);
-
- g_get_current_time(&service->modified);
- service_save(service);
-}
-
static void report_error_cb(void *user_context, bool retry,
void *user_data)
{
--
2.6.0.rc2.230.g3dd15c0
_______________________________________________
connman mailing list
https://lists.connman.net/mailman/listinfo/connman
Patrik Flykt
2015-10-27 11:34:01 UTC
Permalink
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.
Applied, thanks!

The nasingh-ym... email address did not resolve to a existing host, so I
had to remove the From: from the commit message.

Patrik
Loading...