Changeset 402bde for src/Fragmentation


Ignore:
Timestamp:
May 4, 2012, 2:19:07 PM (13 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
b9c486
Parents:
3c4a5e
git-author:
Frederik Heber <heber@…> (12/09/11 20:10:53)
git-committer:
Frederik Heber <heber@…> (05/04/12 14:19:07)
Message:

Placed initiating sockets from Cstor of FragmentScheduler into helper functions.

Location:
src/Fragmentation/Automation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/Automation/FragmentScheduler.cpp

    r3c4a5e r402bde  
    6060{
    6161  Info info(__FUNCTION__);
    62   {
    63     // Start an accept operation for worker connections.
    64     connection_ptr new_conn(new Connection(worker_acceptor_.get_io_service()));
    65     worker_acceptor_.async_accept(new_conn->socket(),
    66       boost::bind(&FragmentScheduler::handle_AcceptWorker, this,
    67         boost::asio::placeholders::error, new_conn));
    68   }
    69 
    70   {
    71     // Start an accept operation for controller connection.
    72     connection_ptr new_conn(new Connection(controller_acceptor_.get_io_service()));
    73     controller_acceptor_.async_accept(new_conn->socket(),
    74       boost::bind(&FragmentScheduler::handle_AcceptController, this,
    75         boost::asio::placeholders::error, new_conn));
    76   }
    77 }
     62
     63  initiateWorkerSocket();
     64
     65  initiateControllerSocket();
     66}
     67
     68/** Internal function to start worker connection.
     69 *
     70 */
     71void FragmentScheduler::initiateWorkerSocket()
     72{
     73  // Start an accept operation for worker connections.
     74  connection_ptr new_conn(new Connection(worker_acceptor_.get_io_service()));
     75  worker_acceptor_.async_accept(new_conn->socket(),
     76    boost::bind(&FragmentScheduler::handle_AcceptWorker, this,
     77      boost::asio::placeholders::error, new_conn));
     78}
     79
     80/** Internal function to start controller connection.
     81 *
     82 */
     83void FragmentScheduler::initiateControllerSocket()
     84{
     85  // Start an accept operation for controller connection.
     86  connection_ptr new_conn(new Connection(controller_acceptor_.get_io_service()));
     87  controller_acceptor_.async_accept(new_conn->socket(),
     88    boost::bind(&FragmentScheduler::handle_AcceptController, this,
     89      boost::asio::placeholders::error, new_conn));
     90}
     91
    7892
    7993/** Handle a new worker connection.
     
    105119      // Start an accept operation for a new Connection only when there
    106120      // are still jobs present otherwise we quit.
    107       connection_ptr new_conn(new Connection(worker_acceptor_.get_io_service()));
    108       worker_acceptor_.async_accept(new_conn->socket(),
    109         boost::bind(&FragmentScheduler::handle_AcceptWorker, this,
    110         boost::asio::placeholders::error, new_conn));
     121      initiateWorkerSocket();
    111122    } else {
    112123      // send the static NoJob
     
    229240  if (JobsQueue.isJobPresent()) {
    230241    // Start an accept operation for a new Connection.
    231     connection_ptr new_conn(new Connection(controller_acceptor_.get_io_service()));
    232     controller_acceptor_.async_accept(new_conn->socket(),
    233       boost::bind(&FragmentScheduler::handle_AcceptController, this,
    234       boost::asio::placeholders::error, new_conn));
     242    initiateControllerSocket();
    235243  } else {
    236244    LOG(1, "INFO: Shutting down controller socket.");
  • src/Fragmentation/Automation/FragmentScheduler.hpp

    r3c4a5e r402bde  
    6868  void handle_CheckResultState(const boost::system::error_code& e, connection_ptr conn);
    6969
     70  /// internal function to prepare worker connections
     71  void initiateWorkerSocket();
     72
     73  /// internal function to prepare controller connections
     74  void initiateControllerSocket();
     75
     76private:
    7077  /// The acceptor object used to accept incoming worker socket connections.
    7178  boost::asio::ip::tcp::acceptor worker_acceptor_;
Note: See TracChangeset for help on using the changeset viewer.