Explorar el Código

[eval] Socket.setTimeout uses seconds

closes #7682
Simon Krajewski hace 6 años
padre
commit
a37320cb57
Se han modificado 2 ficheros con 2 adiciones y 1 borrados
  1. 1 0
      src/macro/eval/evalStdLib.ml
  2. 1 1
      std/sys/net/Socket.hx

+ 1 - 0
src/macro/eval/evalStdLib.ml

@@ -1965,6 +1965,7 @@ module StdSocket = struct
 	let setTimeout = vifun1 (fun vthis timeout ->
 		let this = this vthis in
 		let timeout = match timeout with VNull -> 0. | VInt32 i -> Int32.to_float i | VFloat f -> f | _ -> unexpected_value timeout "number" in
+		let timeout = timeout *. 1000. in
 		setsockopt_float this SO_RCVTIMEO timeout;
 		setsockopt_float this SO_SNDTIMEO timeout;
 		vnull

+ 1 - 1
std/sys/net/Socket.hx

@@ -98,7 +98,7 @@ extern class Socket {
 	function host() : { host : Host, port : Int };
 
 	/**
-		Gives a timeout after which blocking socket operations (such as reading and writing) will abort and throw an exception.
+		Gives a timeout (in seconds) after which blocking socket operations (such as reading and writing) will abort and throw an exception.
 	**/
 	function setTimeout( timeout : Float ) : Void;