Changeset 1287

Show
Ignore:
Timestamp:
11/16/08 00:30:41 (5 years ago)
Author:
ahu
Message:

implement suggestion of ticket 163, add timeout to dnsreplay, thanks Augie!

Files:
1 modified

Legend:

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

    r1275 r1287  
    6666StatBag S; 
    6767bool g_quiet=true; 
     68int g_timeoutMsec=0;  
    6869 
    6970namespace po = boost::program_options; 
     
    337338  IPEndpoint remote; 
    338339 
    339   int res=waitForData(s_socket->getHandle(), 0, 25000); 
     340  int res=waitForData(s_socket->getHandle(), g_timeoutMsec/1000, 1000*(g_timeoutMsec%1000)); 
     341   
    340342  if(res < 0 || res==0) 
    341343    return; 
     
    571573    ("quiet", po::value<bool>()->default_value(true), "don't be too noisy") 
    572574    ("recursive", po::value<bool>()->default_value(true), "look at recursion desired packets, or not (defaults true)") 
    573     ("speedup", po::value<float>()->default_value(1), "replay at this speedup"); 
     575    ("speedup", po::value<float>()->default_value(1), "replay at this speedup") 
     576    ("timeout-msec", po::value<uint32_t>()->default_value(500), "wait at least this many millyseconds for a reply"); 
    574577 
    575578  po::options_description alloptions; 
     
    611614 
    612615  float speedup=g_vm["speedup"].as<float>(); 
     616  g_timeoutMsec=g_vm["timeout-msec"].as<uint32_t>(); 
    613617 
    614618  PcapPacketReader pr(g_vm["pcap-source"].as<string>());