Changeset 672

Show
Ignore:
Timestamp:
04/10/2006 12:19:35 PM (3 years ago)
Author:
ahu
Message:

implement very simple SMP support

Location:
trunk/pdns/pdns
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/pdns_recursor.cc

    r670 r672  
    389389void makeControlChannelSocket() 
    390390{ 
    391   s_rcc.listen(::arg()["socket-dir"]+"/pdns_recursor.controlsocket"); 
     391  string sockname=::arg()["socket-dir"]+"/pdns_recursor.controlsocket"; 
     392  if(::arg().mustDo("fork")) { 
     393    sockname+="."+lexical_cast<string>(getpid()); 
     394    L<<Logger::Warning<<"Forked control socket name: "<<sockname<<endl; 
     395  } 
     396  s_rcc.listen(sockname); 
    392397} 
    393398 
     
    700705    ::arg().set("allow-from", "If set, only allow these comma separated netmasks to recurse")=""; 
    701706    ::arg().set("max-tcp-per-client", "If set, maximum number of TCP sessions per client (IP address)")="0"; 
     707    ::arg().set("fork", "If set, fork the daemon for possible double performance")="no"; 
    702708 
    703709    ::arg().setCmd("help","Provide a helpful message"); 
     
    750756  } 
    751757 
    752     makeClientSocket(); 
    753758    makeUDPServerSockets(); 
    754759    makeTCPServerSockets(); 
     760 
     761    if(::arg().mustDo("fork")) { 
     762      fork(); 
     763      L<<Logger::Warning<<"This is forked pid "<<getpid()<<endl; 
     764    } 
     765    makeClientSocket(); 
     766 
    755767    makeControlChannelSocket(); 
    756768     
  • trunk/pdns/pdns/rec_control.cc

    r633 r672  
    3232{ 
    3333  arg().set("config-dir","Location of configuration directory (pdns.conf)")=SYSCONFDIR; 
     34 
    3435  arg().set("socket-dir","Where the controlsocket will live")=LOCALSTATEDIR; 
     36  arg().set("socket-pid","When controlling multiple recursors, the target pid")=""; 
     37 
    3538  arg().setCmd("help","Provide this helpful message"); 
    3639 
     
    5053 
    5154  RecursorControlChannel rccS; 
    52   rccS.connect(arg()["socket-dir"], "pdns_recursor.controlsocket"); 
     55  string sockname="pdns_recursor.controlsocket"; 
     56  if(!arg()["socket-pid"].empty()) 
     57    sockname+="."+arg()["socket-pid"]; 
     58 
     59  rccS.connect(arg()["socket-dir"], sockname); 
    5360 
    5461  const vector<string>&commands=arg().getCommands();