diff options
| author | Rickard Andersson <gonz@severnatazvezda.com> | 2024-04-19 15:29:28 +0300 |
|---|---|---|
| committer | Rickard Andersson <gonz@severnatazvezda.com> | 2024-04-19 15:29:28 +0300 |
| commit | 7b95562827290258c49e27c7ee8d7be53b7239fe (patch) | |
| tree | cb91841b0a081e36d2e03450f70427eae5c135e7 /core/net/socket_linux.odin | |
| parent | c44f618b7dec82cf80609fd613c93ef91cf6a7ae (diff) | |
feat(net): turn `EPIPE` into `Connection_Closed`
Diffstat (limited to 'core/net/socket_linux.odin')
| -rw-r--r-- | core/net/socket_linux.odin | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/net/socket_linux.odin b/core/net/socket_linux.odin index 9c4342592..d9b29fb3a 100644 --- a/core/net/socket_linux.odin +++ b/core/net/socket_linux.odin @@ -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) |