aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRickard Andersson <gonz@severnatazvezda.com>2024-04-19 15:37:20 +0300
committerRickard Andersson <gonz@severnatazvezda.com>2024-04-19 15:37:20 +0300
commitefc84cd390e6773ee71e35bc851ce4f55f39c34a (patch)
tree97f620b2a144da566986c470ee9062660101df33 /core
parent7b95562827290258c49e27c7ee8d7be53b7239fe (diff)
docs(net): add comment about `EPIPE` -> `Connection_Closed`
Diffstat (limited to 'core')
-rw-r--r--core/net/socket_linux.odin4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/net/socket_linux.odin b/core/net/socket_linux.odin
index d9b29fb3a..ee3a41927 100644
--- a/core/net/socket_linux.odin
+++ b/core/net/socket_linux.odin
@@ -260,7 +260,9 @@ _send_tcp :: proc(tcp_sock: TCP_Socket, buf: []byte) -> (int, Network_Error) {
remaining := buf[total_written:][:limit]
res, errno := linux.send(linux.Fd(tcp_sock), remaining, {.NOSIGNAL})
if errno == .EPIPE {
- return total_written, TCP_Send_Error.Connection_Closed
+ // If the peer is disconnected when we are trying to send we will get an `EPIPE` error,
+ // so we turn that into a clearer error
+ return total_written, .Connection_Closed
} else if errno != .NONE {
return total_written, TCP_Send_Error(errno)
}