diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 20:06:09 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 20:07:30 -0700 |
commit | 28191d317a46a1aeb3ec2034de2da626c38b6d73 (patch) | |
tree | aad08fe0e1133b7374e247efe29dac4dea47e04e /092socket.mu | |
parent | ccfee30398074e2b5276a0ba295464ded4945ec9 (diff) | |
download | mu-28191d317a46a1aeb3ec2034de2da626c38b6d73.tar.gz |
3571 - make 'read-from-socket' non-blocking
Its interface now mirrors that of 'read-event'.
Diffstat (limited to '092socket.mu')
-rw-r--r-- | 092socket.mu | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/092socket.mu b/092socket.mu index 7acaea63..b1c08b6a 100644 --- a/092socket.mu +++ b/092socket.mu @@ -166,7 +166,14 @@ def receive-from-socket socket:num, sink:&:sink:char -> sink:&:sink:char [ local-scope load-ingredients { - req:text, eof?:bool <- $read-from-socket socket, 4096/bytes + +next-attempt + req:text, found?:bool, eof?:bool, error:num <- $read-from-socket socket, 4096/bytes + break-if error + { + break-if found? + switch + loop +next-attempt + } bytes-read:num <- length *req i:num <- copy 0 { |