[rygel/wip/basic-management: 28/49] core: Simplify BasicManagement Ping state handling



commit 0184b5f8526a09cdd51e25ce4e333131b0b1283b
Author: Jussi Kukkonen <jussi kukkonen intel com>
Date:   Thu Jun 6 11:04:49 2013 +0300

    core: Simplify BasicManagement Ping state handling
    
    The base class will normally handle execution state: setting it to
    complete can be used to skip iterations but Ping does not need that.

 .../rygel-basic-management-test-ping.vala          |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/src/librygel-core/rygel-basic-management-test-ping.vala 
b/src/librygel-core/rygel-basic-management-test-ping.vala
index 6c0877c..422a92f 100644
--- a/src/librygel-core/rygel-basic-management-test-ping.vala
+++ b/src/librygel-core/rygel-basic-management-test-ping.vala
@@ -189,13 +189,9 @@ internal class Rygel.BasicManagementTestPing : BasicManagementTest {
     }
 
     protected override void finish_iteration () {
-        switch (this.init_state) {
-            case InitState.SPAWN_FAILED:
-                this.status = Status.ERROR_INTERNAL;
-                this.additional_info = "Failed to spawn ping";
-                break;
-            default:
-                break;
+        if (this.init_state == InitState.SPAWN_FAILED) {
+            this.status = Status.ERROR_INTERNAL;
+            this.additional_info = "Failed to spawn ping";
         }
 
         base.finish_iteration ();
@@ -204,11 +200,9 @@ internal class Rygel.BasicManagementTestPing : BasicManagementTest {
     protected override void handle_error (string line) {
         if (line.contains ("ping: unknown host")) {
             this.status = Status.ERROR_CANNOT_RESOLVE_HOSTNAME;
-            this.execution_state = ExecutionState.COMPLETED;
         } else if (line.contains ("ping:")) {
             this.status = Status.ERROR_OTHER;
             this.additional_info = line.substring ("ping:".length).strip ();
-            this.execution_state = ExecutionState.COMPLETED;
         }
     }
 
@@ -231,8 +225,6 @@ internal class Rygel.BasicManagementTestPing : BasicManagementTest {
             }
         } else if (this.state == ProcessState.RTT) {
             if (line.contains ("min/avg/max")) {
-                this.execution_state = ExecutionState.COMPLETED;
-
                 var rtt = line.split ("=", 2);
                 if (rtt.length >= 2) {
                     var rtt_values = rtt[1].split ("/", 4);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]