about summary refs log tree commit diff stats
path: root/src/io/posixstream.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-22 20:14:08 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-22 20:14:19 +0100
commit78ffc938fa7e4baad0a55625026b765d215be1aa (patch)
tree857db2e963efb13933d1e7954e9d4dc657b6f11d /src/io/posixstream.nim
parentdef15ede4fbd686b0ee9b193f41b2a47190aa43a (diff)
downloadchawan-78ffc938fa7e4baad0a55625026b765d215be1aa.tar.gz
Replace Chakasu with Chagashi
The API is horrid :( but at least it copies less.

TODO: think of a better API.
Diffstat (limited to 'src/io/posixstream.nim')
-rw-r--r--src/io/posixstream.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/io/posixstream.nim b/src/io/posixstream.nim
index 683d72b8..c9c1c234 100644
--- a/src/io/posixstream.nim
+++ b/src/io/posixstream.nim
@@ -74,7 +74,13 @@ proc psClose(s: Stream) =
 proc psReadData(s: Stream, buffer: pointer, len: int): int =
   let s = PosixStream(s)
   assert len != 0 and s.blocking
-  return s.recvData(buffer, len)
+  result = 0
+  while result < len:
+    let p = addr cast[ptr UncheckedArray[uint8]](buffer)[result]
+    let n = s.recvData(p, len - result)
+    if n == 0:
+      break
+    result += n
 
 proc psWriteData(s: Stream, buffer: pointer, len: int) =
   let s = PosixStream(s)
ter Kartik K. Agaram <vc@akkartik.com> 2015-09-07 10:37:27 -0700 2177' href='/akkartik/mu/commit/update_html?h=main&id=f5465e1220d73e237c51897b7d1211ec53b0dc04'>f5465e12 ^
e6056999 ^

4a39d12d ^


4c4d325c ^
4a39d12d ^



f5465e12 ^

4a39d12d ^

e6056999 ^

70f4e9b6 ^
c0e9154d ^
f5465e12 ^
ccae4585 ^





f5465e12 ^


ba6621b5 ^




f40b079c ^
ba6621b5 ^




201458e3 ^
ba6621b5 ^




9a7e1a0f ^
ba6621b5 ^






9a7e1a0f ^
ba6621b5 ^


608a7fa8 ^
ba6621b5 ^


25ad969f ^
c762564b ^
5a2cb154 ^
608a7fa8 ^



c762564b ^
9a7e1a0f ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90