Răsfoiți Sursa

fix reading large(-ish) amounts of data from completion server socket

it should fail at 100 empty reads in a row, not after 100 any reads
Dan Korostelev 9 ani în urmă
părinte
comite
0e1fa87c36
1 a modificat fișierele cu 8 adăugiri și 5 ștergeri
  1. 8 5
      src/main.ml

+ 8 - 5
src/main.ml

@@ -857,11 +857,14 @@ and wait_loop boot_com host port =
 			if r > 0 && tmp.[r-1] = '\000' then
 				Buffer.sub b 0 (Buffer.length b - 1)
 			else begin
-				if r = 0 then ignore(Unix.select [] [] [] 0.05); (* wait a bit *)
-				if count = 100 then
-					failwith "Aborting unactive connection"
-				else
-					read_loop (count + 1);
+				if r = 0 then begin
+					ignore(Unix.select [] [] [] 0.05); (* wait a bit *)
+					if count = 100 then
+						failwith "Aborting inactive connection"
+					else
+						read_loop (count + 1);
+				end else
+					read_loop 0;
 			end;
 		in
 		let rec cache_context com =