From f8b062047047ed709673603dd3368de2abde2293 Mon Sep 17 00:00:00 2001 From: Ramin Yaghoubzadeh <ryaghoub@techfak.uni-bielefeld.de> Date: Mon, 20 Aug 2012 21:29:09 +0200 Subject: [PATCH] Added RemoteServer timeout constant. Changed resolve unpack. --- ipaacalib/cpp/include/ipaaca/ipaaca.h | 7 ++++++- ipaacalib/cpp/src/ipaaca.cc | 6 +++--- resolve.sh | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ipaacalib/cpp/include/ipaaca/ipaaca.h b/ipaacalib/cpp/include/ipaaca/ipaaca.h index 89e8a32..3377b50 100644 --- a/ipaacalib/cpp/include/ipaaca/ipaaca.h +++ b/ipaacalib/cpp/include/ipaaca/ipaaca.h @@ -11,7 +11,6 @@ /// date of last release number increment #define IPAACA_CPP_RELEASE_DATE "2012-04-13" - #ifdef IPAACA_DEBUG_MESSAGES #define IPAACA_INFO(i) std::cout << __FILE__ << ":" << __LINE__ << ": " << __func__ << "() -- " << i << std::endl; #define IPAACA_WARNING(i) std::cout << __FILE__ << ":" << __LINE__ << ": " << __func__ << "() -- WARNING: " << i << std::endl; @@ -24,12 +23,17 @@ #define IPAACA_TODO(i) ; #endif + /// marking pure virtual functions for extra readability #define _IPAACA_ABSTRACT_ /// value to return when reading nonexistant payload keys #define IPAACA_PAYLOAD_DEFAULT_STRING_VALUE "" +// seconds until remote writes time out +#define IPAACA_REMOTE_SERVER_TIMEOUT 2.0 + + #include <iostream> #include <boost/thread.hpp> @@ -193,6 +197,7 @@ class Buffer { //: public boost::enable_shared_from_this<Buffer> {//{{{ friend class CallbackIULinkUpdate; friend class CallbackIUCommission; protected: + //Lock _handler_lock; std::string _uuid; std::string _basename; std::string _unique_name; diff --git a/ipaacalib/cpp/src/ipaaca.cc b/ipaacalib/cpp/src/ipaaca.cc index f73a81a..bd246c4 100644 --- a/ipaacalib/cpp/src/ipaaca.cc +++ b/ipaacalib/cpp/src/ipaaca.cc @@ -880,7 +880,7 @@ void RemotePushIU::_modify_links(bool is_delta, const LinkMap& new_links, const update->writer_name = _buffer->unique_name(); update->new_links = new_links; update->links_to_remove = links_to_remove; - boost::shared_ptr<int> result = server->call<int>("updateLinks", update, 1); // TODO 1 sec + boost::shared_ptr<int> result = server->call<int>("updateLinks", update, IPAACA_REMOTE_SERVER_TIMEOUT); // TODO if (*result == 0) { throw IUUpdateFailedError(); } else { @@ -903,7 +903,7 @@ void RemotePushIU::_modify_payload(bool is_delta, const std::map<std::string, st update->writer_name = _buffer->unique_name(); update->new_items = new_items; update->keys_to_remove = keys_to_remove; - boost::shared_ptr<int> result = server->call<int>("updatePayload", update, 1); // TODO 1 sec + boost::shared_ptr<int> result = server->call<int>("updatePayload", update, IPAACA_REMOTE_SERVER_TIMEOUT); // TODO if (*result == 0) { throw IUUpdateFailedError(); } else { @@ -925,7 +925,7 @@ void RemotePushIU::commit() update->set_uid(_uid); update->set_revision(_revision); update->set_writer_name(_buffer->unique_name()); - boost::shared_ptr<int> result = server->call<int>("commit", update, 1); // TODO 1 sec + boost::shared_ptr<int> result = server->call<int>("commit", update, IPAACA_REMOTE_SERVER_TIMEOUT); // TODO if (*result == 0) { throw IUUpdateFailedError(); } else { diff --git a/resolve.sh b/resolve.sh index 25386c5..ae425de 100755 --- a/resolve.sh +++ b/resolve.sh @@ -23,7 +23,7 @@ for P in $PACKAGES; do [ "$files" ] && cp -a ../$P/dist/scripts/* deps/scripts/ files=(../$P/dist/python/*.zip); [ "$files" ] && for zipfile in ../$P/dist/python/*.zip; do - unzip -qq $zipfile -d deps/python + unzip -oqq $zipfile -d deps/python done done -- GitLab