raise the ping timeout from 2s to 10s (avoid #294)
This commit is contained in:
		
							parent
							
								
									a41534ca60
								
							
						
					
					
						commit
						527e0c3444
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		|  | @ -21,15 +21,17 @@ function Ping(host, options) { | ||||||
| 
 | 
 | ||||||
|     events.EventEmitter.call(this); |     events.EventEmitter.call(this); | ||||||
| 
 | 
 | ||||||
|  |     const timeout = 10; | ||||||
|  | 
 | ||||||
|     if (WIN) { |     if (WIN) { | ||||||
|         this._bin = "c:/windows/system32/ping.exe"; |         this._bin = "c:/windows/system32/ping.exe"; | ||||||
|         this._args = (options.args) ? options.args : [ "-n", "1", "-w", "5000", host ]; |         this._args = (options.args) ? options.args : [ "-n", "1", "-w", timeout * 1000, host ]; | ||||||
|         this._regmatch = /[><=]([0-9.]+?)ms/; |         this._regmatch = /[><=]([0-9.]+?)ms/; | ||||||
| 
 | 
 | ||||||
|     } else if (LIN) { |     } else if (LIN) { | ||||||
|         this._bin = "/bin/ping"; |         this._bin = "/bin/ping"; | ||||||
| 
 | 
 | ||||||
|         const defaultArgs = [ "-n", "-w", "2", "-c", "1", host ]; |         const defaultArgs = [ "-n", "-w", timeout, "-c", "1", host ]; | ||||||
| 
 | 
 | ||||||
|         if (net.isIPv6(host) || options.ipv6) { |         if (net.isIPv6(host) || options.ipv6) { | ||||||
|             defaultArgs.unshift("-6"); |             defaultArgs.unshift("-6"); | ||||||
|  | @ -46,13 +48,13 @@ function Ping(host, options) { | ||||||
|             this._bin = "/sbin/ping"; |             this._bin = "/sbin/ping"; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this._args = (options.args) ? options.args : [ "-n", "-t", "2", "-c", "1", host ]; |         this._args = (options.args) ? options.args : [ "-n", "-t", timeout, "-c", "1", host ]; | ||||||
|         this._regmatch = /=([0-9.]+?) ms/; |         this._regmatch = /=([0-9.]+?) ms/; | ||||||
| 
 | 
 | ||||||
|     } else if (FBSD) { |     } else if (FBSD) { | ||||||
|         this._bin = "/sbin/ping"; |         this._bin = "/sbin/ping"; | ||||||
| 
 | 
 | ||||||
|         const defaultArgs = [ "-n", "-t", "2", "-c", "1", host ]; |         const defaultArgs = [ "-n", "-t", timeout, "-c", "1", host ]; | ||||||
| 
 | 
 | ||||||
|         if (net.isIPv6(host) || options.ipv6) { |         if (net.isIPv6(host) || options.ipv6) { | ||||||
|             defaultArgs.unshift("-6"); |             defaultArgs.unshift("-6"); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue