feat(net): turn EPIPE into Connection_Closed

This commit is contained in:
Rickard Andersson
2024-04-19 15:29:28 +03:00
parent c44f618b7d
commit 7b95562827
2 changed files with 3 additions and 2 deletions
+3 -1
View File
@@ -259,7 +259,9 @@ _send_tcp :: proc(tcp_sock: TCP_Socket, buf: []byte) -> (int, Network_Error) {
limit := min(int(max(i32)), len(buf) - total_written)
remaining := buf[total_written:][:limit]
res, errno := linux.send(linux.Fd(tcp_sock), remaining, {.NOSIGNAL})
if errno != .NONE {
if errno == .EPIPE {
return total_written, TCP_Send_Error.Connection_Closed
} else if errno != .NONE {
return total_written, TCP_Send_Error(errno)
}
total_written += int(res)