diff options
author | bptato <nincsnevem662@gmail.com> | 2022-11-27 15:44:42 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-11-27 15:44:42 +0100 |
commit | 3a12afa7617f3ccecbbf6b5852da3d6382a412bb (patch) | |
tree | 7596ce7f667b9dabec6ec71c9bd05b9de67feb93 /src/ips | |
parent | e7f157c792f53cb084e8694ee608f00727432a3d (diff) | |
download | chawan-3a12afa7617f3ccecbbf6b5852da3d6382a412bb.tar.gz |
Fix some regressions, add loading progress bar
Diffstat (limited to 'src/ips')
-rw-r--r-- | src/ips/socketstream.nim | 9 |
1 files changed, 8 insertions, 1 deletions
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: |