Changeset 8e7a1b
- Timestamp:
- Mar 9, 2017, 10:16:58 PM (8 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_ChronosMutex, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
- Children:
- f67dfb
- Parents:
- c300e2
- git-author:
- Frederik Heber <heber@…> (02/23/17 14:26:57)
- git-committer:
- Frederik Heber <heber@…> (03/09/17 22:16:58)
- Location:
- ThirdParty/JobMarket/src/JobMarket/Operations
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified ThirdParty/JobMarket/src/JobMarket/Operations/AsyncOperation.cpp ¶
rc300e2 r8e7a1b 33 33 #include "CodePatterns/Log.hpp" 34 34 35 void NoOp() {}35 static void NoOp() {} 36 36 37 37 // static instances … … 48 48 { 49 49 LOG(1, "INFO: AsyncOperation completed."); 50 status = Operation::success; 50 51 callback_on_success(); 51 52 } … … 54 55 // An error occurred. 55 56 ELOG(1, e.message()); 57 status = Operation::error; 56 58 callback_on_failure(); 57 59 } … … 76 78 DEBUG_FUNCTION_ENTRYEXIT 77 79 80 status = Operation::running; 81 78 82 // Resolve the host name into an IP address. 79 83 boost::asio::ip::tcp::resolver resolver(connection_.socket().get_io_service()); 80 84 boost::asio::ip::tcp::resolver::query query(_host, _service); 85 boost::system::error_code ec; 81 86 boost::asio::ip::tcp::resolver::iterator endpoint_iterator = 82 resolver.resolve(query); 83 boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; 87 resolver.resolve(query, ec); 88 // check whether host could be resolved 89 if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) { 90 boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; 84 91 85 // Start an asynchronous connect operation. 86 LOG(3, "DEBUG: Connecting asynchronously to endpoint " << endpoint << " ..."); 87 connection_.socket().async_connect(endpoint, 88 boost::bind(&AsyncOperation::handle_connect, this, 89 boost::asio::placeholders::error, ++endpoint_iterator)); 92 // Start an asynchronous connect operation. 93 LOG(3, "DEBUG: Connecting asynchronously to endpoint " << endpoint << " ..."); 94 connection_.socket().async_connect(endpoint, 95 boost::bind(&AsyncOperation::handle_connect, this, 96 boost::asio::placeholders::error, ++endpoint_iterator)); 97 } else { 98 // this will allow to still listen on the socket for other connections 99 handle_FinishOperation(ec); 100 } 90 101 } -
TabularUnified ThirdParty/JobMarket/src/JobMarket/Operations/Operation.hpp ¶
rc300e2 r8e7a1b 34 34 Operation(const std::string &_name, Connection &_connection) : 35 35 connection_(_connection), 36 status(not_started), 36 37 name(_name) 37 38 {} … … 56 57 } 57 58 59 //!> enumeration of status codes of the operation 60 enum StatusCodes { 61 not_started, 62 running, 63 error, 64 success 65 }; 66 67 /** Returns the current status of the operation. 68 * 69 * \return status code 70 */ 71 enum StatusCodes getStatus() const { 72 return status; 73 } 74 58 75 protected: 59 // /The Connection to the server.76 //!> The Connection to the server. 60 77 Connection &connection_; 61 78 79 //!> current status of the operation 80 enum StatusCodes status; 81 62 82 private: 63 // /Name of this AsyncOperation (required for Registry pattern)83 //!> Name of this AsyncOperation (required for Registry pattern) 64 84 std::string name; 65 85 }; -
TabularUnified ThirdParty/JobMarket/src/JobMarket/Operations/SyncOperation.cpp ¶
rc300e2 r8e7a1b 42 42 boost::asio::ip::tcp::resolver::iterator endpoint_iterator = 43 43 resolver.resolve(query); 44 boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; 44 // check whether host could be resolved 45 if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) { 46 boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator; 45 47 46 // Start an asynchronous connect operation. 47 LOG(3, "DEBUG: Connecting synchronously to endpoint " << endpoint << " ..."); 48 connection_.socket().connect(endpoint); 48 // Start an asynchronous connect operation. 49 LOG(3, "DEBUG: Connecting synchronously to endpoint " << endpoint << " ..."); 50 connection_.socket().connect(endpoint); 51 } else { 52 status = Operation::error; 53 } 49 54 } 50 55 … … 67 72 DEBUG_FUNCTION_ENTRYEXIT 68 73 74 status = Operation::running; 75 69 76 // connect 70 77 connect(_host, _service); … … 75 82 // disconnect 76 83 disconnect(); 84 85 if (status == Operation::running) 86 status = Operation::success; 77 87 }
Note:
See TracChangeset
for help on using the changeset viewer.