diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 21:15:43 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 21:15:43 -0700 |
commit | 0606f4ace4fc6f610c89d8b7f561e09cc486b952 (patch) | |
tree | 39c15b3d0929ec575b083630bc8977bea849ee77 /092socket.mu | |
parent | b1f0fa4dc98a65dd956ded0eadce3bd9d010d100 (diff) | |
download | mu-0606f4ace4fc6f610c89d8b7f561e09cc486b952.tar.gz |
3574
Shorter branches above longer ones.
Diffstat (limited to '092socket.mu')
-rw-r--r-- | 092socket.mu | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/092socket.mu b/092socket.mu index 5e788da2..4ca07d99 100644 --- a/092socket.mu +++ b/092socket.mu @@ -74,19 +74,19 @@ def start-reading-from-network resources:&:resources, uri:text -> contents:&:sou port <- copy 80/http-port } { - break-if resources - # real network - host:text, path:text <- split-at uri, 47/slash - socket:num <- $open-client-socket host, port - assert socket, [contents] - req:text <- interpolate [GET _ HTTP/1.1], path - request-socket socket, req - contents:&:source:char, sink:&:sink:char <- new-channel 10000 - start-running receive-from-socket socket, sink + break-unless resources + # fake network + contents <- start-reading-from-fake-resources resources, uri return } - # fake network - contents <- start-reading-from-fake-resources resources, uri + # real network + host:text, path:text <- split-at uri, 47/slash + socket:num <- $open-client-socket host, port + assert socket, [contents] + req:text <- interpolate [GET _ HTTP/1.1], path + request-socket socket, req + contents:&:source:char, sink:&:sink:char <- new-channel 10000 + start-running receive-from-socket socket, sink ] def request-socket socket:num, s:text -> socket:num [ |