From 3a12afa7617f3ccecbbf6b5852da3d6382a412bb Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 27 Nov 2022 15:44:42 +0100 Subject: Fix some regressions, add loading progress bar --- src/ips/socketstream.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/ips') diff --git a/src/ips/socketstream.nim b/src/ips/socketstream.nim index 6ce9bd88..6df9f09b 100644 --- a/src/ips/socketstream.nim +++ b/src/ips/socketstream.nim @@ -10,11 +10,18 @@ import ips/serversocket type SocketStream* = ref object of Stream source*: Socket + recvw*: bool isend: bool proc sockReadData(s: Stream, buffer: pointer, len: int): int = let s = SocketStream(s) - result = s.source.recv(buffer, len) + try: + if s.recvw: + result = s.source.recv(buffer, len, 100) + else: + result = s.source.recv(buffer, len) + except TimeoutError: + return if result < 0: raise newException(IOError, "Failed to read data (code " & $osLastError() & ")") elif result < len: -- cgit