浏览代码

enable bind adresss reuse (closed #1980)

Nicolas Cannasse 12 年之前
父节点
当前提交
70366b18e3
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      main.ml

+ 1 - 0
main.ml

@@ -506,6 +506,7 @@ let rec process_params create pl =
 
 and wait_loop boot_com host port =
 	let sock = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in
+	(try Unix.setsockopt sock Unix.SO_REUSEADDR true with _ -> ());
 	(try Unix.bind sock (Unix.ADDR_INET (Unix.inet_addr_of_string host,port)) with _ -> failwith ("Couldn't wait on " ^ host ^ ":" ^ string_of_int port));
 	Unix.listen sock 10;
 	Sys.catch_break false;