@@ -3,6 +3,7 @@ extern crate rustc_serialize;
33extern crate openssl;
44#[ macro_use] extern crate log;
55extern crate env_logger;
6+ extern crate num_cpus;
67
78use docopt:: Docopt ;
89use std:: net:: TcpStream ;
@@ -29,7 +30,7 @@ Options:
2930 --cycles=C Total number of additional \" keepalive\" headers to be sent. [default: 10]
3031 --domain=D Override the domain name for SSL connections (e.g., if you're connecting to a raw IP address)
3132 --repeat Perform the attack repeatedly (WARNING - Can produce a DoS condition!)
32- --threads=T The number of concurrent threads to spin off. [default: 1]
33+ --threads=T The number of concurrent threads to spin off. Defaults to the number of CPUs.
3334" ;
3435
3536#[ derive( Debug , RustcDecodable ) ]
@@ -42,7 +43,7 @@ struct Args {
4243 flag_nofinalize : bool ,
4344 flag_domain : Option < String > ,
4445 flag_repeat : bool ,
45- flag_threads : usize ,
46+ flag_threads : Option < usize > ,
4647 cmd_get : bool ,
4748 cmd_post : bool
4849}
@@ -87,7 +88,7 @@ fn main() {
8788 let cycles = args. flag_cycles ;
8889 let timeout = args. flag_timeout ;
8990 let repeat = args. flag_repeat ;
90- let threads = args. flag_threads ;
91+ let threads = args. flag_threads . unwrap_or ( num_cpus :: get ( ) ) ;
9192 let ssl = args. flag_ssl ;
9293 let cmd_get = args. cmd_get ;
9394 let cmd_post = args. cmd_post ;
0 commit comments