diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-21 21:56:46 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-21 23:17:00 +0100 |
commit | 2e1f31470dd0bd092f2ebcbda9ddcdaa3067beb7 (patch) | |
tree | 432207cf29737cac561c3b3fff187d52f3c3f5e0 /src/io | |
parent | aad2c9860410cdbe0a80b48aba74437994cfd3e1 (diff) | |
download | chawan-2e1f31470dd0bd092f2ebcbda9ddcdaa3067beb7.tar.gz |
buffer: clean up ssock on being killed
* use signal handlers to avoid littering tmpdir with dead sockets * add connection reset error (for socketstream) * convert some imports to new style
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/posixstream.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/io/posixstream.nim b/src/io/posixstream.nim index 970a50e6..5e9082a9 100644 --- a/src/io/posixstream.nim +++ b/src/io/posixstream.nim @@ -13,6 +13,7 @@ type ErrorFault* = object of IOError ErrorInterrupted* = object of IOError ErrorInvalid* = object of IOError + ErrorConnectionReset* = object of IOError proc raisePosixIOError*() = # In the nim stdlib, these are only constants on linux amd64, so we @@ -27,6 +28,8 @@ proc raisePosixIOError*() = raise newException(ErrorFault, "fault") elif errno == EINVAL: raise newException(ErrorInvalid, "invalid") + elif errno == ECONNRESET: + raise newException(ErrorConnectionReset, "connection reset by peer") else: raise newException(IOError, $strerror(errno)) |