diff options
author | Runxi Yu <me@runxiyu.org> | 2025-02-18 08:33:32 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-02-18 08:33:32 +0800 |
commit | 7b08b7b712c51a99e1b76483c4c202488d987da4 (patch) | |
tree | b6d159aea98f1858d0f4271fa4c9c54cd74eff62 /ssh_handle_receive_pack.go | |
parent | repo_index.html: Move the repo description before the clone URLs (diff) | |
download | forge-7b08b7b712c51a99e1b76483c4c202488d987da4.tar.gz forge-7b08b7b712c51a99e1b76483c4c202488d987da4.tar.zst forge-7b08b7b712c51a99e1b76483c4c202488d987da4.zip |
hooks: Fix the race condition that causes EPIPE
The hooks handler in the main daemon didn't wait for the hook client to
write fully, and sometimes prematurely closes the connection, causing
the hook client's splice to return EPIPE (or SIGPIPE if the signal
handler wasn't installed).
To remedy this, we call shutdown(sock, SHUT_WR) in the client, so that
attempts to read on the server side return EOF. Then we can simply use
io.Copy(&buf, conn) on the server side to fetch all of the data into a
buffer.
Diffstat (limited to 'ssh_handle_receive_pack.go')
0 files changed, 0 insertions, 0 deletions