*/
void DHS::update(const string& ip)
{
- // if update was successful, we need to set the lastupdated base member.
- time_t actual_time = time(NULL);
- set_lastupdated(actual_time);
+ if ( this->get_actual_ip() != ip )
+ {
+ this->get_logger()->print_update_service("DHS");
+
+ if ( perform_update(ip) == 0 )
+ {
+ // if update was successful, we need to set the Lastupdated and ActualIP base member.
+ this->set_lastupdated(time(NULL));
+ this->set_actual_ip(ip);
+ this->get_logger()->print_update_service_successful("DHS");
+ }
+ }
+}
+
- get_logger()->print_update_service("DHS");
+/**
+ * Performs the Service update.
+ * @param ip IP Address to set.
+ * @return 0 if all is fine, -1 otherwise.
+ */
+int DHS::perform_update(const std::string& ip)
+{
+ return 0;
}
int get_max_updates_within_timeout() const;
void update(const std::string&);
+
+ int perform_update(const std::string&);
};
#endif
void print_own_ip(const std::string&, const std::string&) const;
void print_error_hostname_to_ip(const std::string&, const std::string&) const;
+
+ void print_update_service_successful(const std::string&);
};
#endif