about summary refs log tree commit diff stats
path: root/src/loader/loaderhandle.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader/loaderhandle.nim')
-rw-r--r--src/loader/loaderhandle.nim63
1 files changed, 23 insertions, 40 deletions
diff --git a/src/loader/loaderhandle.nim b/src/loader/loaderhandle.nim
index 1cddd5f8..7a9b3434 100644
--- a/src/loader/loaderhandle.nim
+++ b/src/loader/loaderhandle.nim
@@ -46,50 +46,33 @@ proc addOutputStream*(handle: LoaderHandle, stream: Stream) =
     let ms = newMultiStream(handle.ostream, stream)
     handle.ostream = ms
 
-proc sendResult*(handle: LoaderHandle, res: int, msg = ""): bool =
-  try:
-    handle.ostream.swrite(res)
-    if res == 0: # success
-      assert msg == ""
-    else: # error
-      handle.ostream.swrite(msg)
-    return true
-  except IOError: # broken pipe
-    return false
+proc sendResult*(handle: LoaderHandle, res: int, msg = "") =
+  handle.ostream.swrite(res)
+  if res == 0: # success
+    assert msg == ""
+  else: # error
+    handle.ostream.swrite(msg)
 
-proc sendStatus*(handle: LoaderHandle, status: int): bool =
-  try:
-    handle.ostream.swrite(status)
-    return true
-  except IOError: # broken pipe
-    return false
+proc sendStatus*(handle: LoaderHandle, status: int) =
+  handle.ostream.swrite(status)
 
-proc sendHeaders*(handle: LoaderHandle, headers: Headers): bool =
-  try:
-    handle.ostream.swrite(headers)
-    if handle.canredir:
-      var redir: bool
-      handle.ostream.sread(redir)
-      if redir:
-        let fd = SocketStream(handle.ostream).recvFileHandle()
-        handle.sostream = handle.ostream
-        let stream = newPosixStream(fd)
-        handle.ostream = stream
-    return true
-  except IOError: # broken pipe
-    return false
+proc sendHeaders*(handle: LoaderHandle, headers: Headers) =
+  handle.ostream.swrite(headers)
+  if handle.canredir:
+    var redir: bool
+    handle.ostream.sread(redir)
+    if redir:
+      let fd = SocketStream(handle.ostream).recvFileHandle()
+      handle.sostream = handle.ostream
+      let stream = newPosixStream(fd)
+      handle.ostream = stream
 
-proc sendData*(handle: LoaderHandle, p: pointer, nmemb: int): bool =
-  try:
-    handle.ostream.writeData(p, nmemb)
-    return true
-  except IOError: # broken pipe
-    return false
+proc sendData*(handle: LoaderHandle, p: pointer, nmemb: int) =
+  handle.ostream.writeData(p, nmemb)
 
-proc sendData*(handle: LoaderHandle, s: string): bool =
+proc sendData*(handle: LoaderHandle, s: string) =
   if s.len > 0:
-    return handle.sendData(unsafeAddr s[0], s.len)
-  return true
+    handle.sendData(unsafeAddr s[0], s.len)
 
 proc suspend*(handle: LoaderHandle) =
   handle.sostream_suspend = handle.ostream
@@ -99,7 +82,7 @@ proc resume*(handle: LoaderHandle) =
   let ss = handle.ostream
   handle.ostream = handle.sostream_suspend
   handle.sostream_suspend = nil
-  discard handle.sendData(ss.readAll())
+  handle.sendData(ss.readAll())
   ss.close()
 
 proc close*(handle: LoaderHandle) =