Changeset 81c96b6 for src/Fragmentation


Ignore:
Timestamp:
Jul 2, 2012, 8:32:01 AM (12 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:
92b1d3
Parents:
270364
git-author:
Frederik Heber <heber@…> (04/24/12 16:26:01)
git-committer:
Frederik Heber <heber@…> (07/02/12 08:32:01)
Message:

FIX: Listener (and PoolWorker) now check whether address to listen on is in use.

  • we use acceptor construction as given in boost::asio::basic_socket_acceptor to listen on the desired port. Bind gives error code when error occurs.
Location:
src/Fragmentation/Automation
Files:
3 edited

Legend:

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

    r270364 r81c96b6  
    3434Listener::Listener(boost::asio::io_service& io_service, unsigned short port) :
    3535    Exitflag(OkFlag),
    36     acceptor_(io_service,
    37         boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)
    38     )
     36    acceptor_(io_service)
    3937{
    40   LOG(1, "Listening on port " << port << ".");
     38//  // enable abort reporting
     39//  boost::asio::socket_base::enable_connection_aborted option(true);
     40//  acceptor_.set_option(option);
     41  // state endpoint
     42  boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port);
     43  acceptor_.open(endpoint.protocol());
     44  boost::system::error_code ec;
     45  acceptor_.bind(endpoint, ec);
     46  if (!ec) {
     47    acceptor_.listen();
     48    LOG(1, "Listening on port " << port << ".");
     49  } else {
     50    ELOG(0, "Binding failed on port " << port << ": " << ec.message());
     51  }
    4152}
    4253
     
    7485    if (errorcode)
    7586    {
     87      Exitflag = ErrorFlag;
    7688      ELOG(1, "socket.shutdown error: " << errorcode.message());
    7789    }
     
    8193    if (errorcode)
    8294    {
     95      Exitflag = ErrorFlag;
    8396      ELOG(1, "socket.close error: " << errorcode.message());
    8497    }
  • src/Fragmentation/Automation/Pool/PoolWorker.cpp

    r270364 r81c96b6  
    104104    // accept operation the io_service will run out of work to do and the
    105105    // server will exit.
     106    Exitflag = ErrorFlag;
    106107    ELOG(0, e.message());
    107108  }
     
    128129    // accept operation the io_service will run out of work to do and the
    129130    // server will exit.
     131    Exitflag = ErrorFlag;
    130132    ELOG(0, e.message());
    131133  }
  • src/Fragmentation/Automation/Pool/PoolWorker.hpp

    r270364 r81c96b6  
    4747  size_t getFlag() const
    4848  {
    49     return submitOp.getFlag();
     49    return submitOp.getFlag() + PoolListener.getExitflag();
    5050  }
    5151
Note: See TracChangeset for help on using the changeset viewer.