Last steps on DHS service.
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Thu, 17 Sep 2009 15:35:49 +0000 (17:35 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Thu, 17 Sep 2009 15:35:49 +0000 (17:35 +0200)
src/service_dhs.cpp

index 337cca9..46c30bf 100644 (file)
@@ -12,6 +12,7 @@
 #include <time.h>
 #include <boost/foreach.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/regex.hpp>
 
 namespace ba = boost::algorithm;
 
@@ -147,8 +148,20 @@ int ServiceDhs::perform_update(const std::string& ip)
     // Check the status code for protocol errors.
     if ( http_status_code == 200 )
     {
-        // TODO: Account related errors should be handled here!
-        return 0;
+        // Get the received http data.
+        string curl_data = HTTPHelp->get_curl_data();
+
+        // Search for the following string in the received http data
+        boost::regex expr_done("Updating ip on .*: done");
+        if ( boost::regex_search(curl_data,expr_done) )
+        {
+            // Update successful
+            return 0;
+        }
+        else
+        {
+            get_logger()->print_update_failure(url,curl_data);
+        }
     }
     else if ( http_status_code == 401 )
     {