commit 00e0705065383afc96aab09ee41d09ca4c76a2d5 from: Aleksey Ryndin date: Mon Sep 11 11:31:28 2023 UTC Fix: ignore SIGPIPE commit - 5e7561542faa3aaedb393525a646c82fb7811c7a commit + 00e0705065383afc96aab09ee41d09ca4c76a2d5 blob - 3d747c03afa11b9d1acf05ac00a5bb5276c21b51 blob + 6baca4a63621b979b8a99635af6e57c175e237a9 --- vostok/transport.cc +++ vostok/transport.cc @@ -172,19 +172,20 @@ send( /* in */ Span buff ) { - ssize_t ret{0}; while (buff.size() > 0) { - ret = tls_write(ctx, buff.begin(), buff.size()); + auto ret = tls_write(ctx, buff.begin(), buff.size()); if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) continue; + + if (ret == -1) + { + error::occurred("TLS write", PrintIfError{tls_error(ctx)}); + return false; + } + buff = buff.subspan(ret); } - if (ret == -1) - { - error::occurred("TLS write", PrintIfError{tls_error(ctx)}); - return false; - } return true; } blob - 22377af14c3007012e8fa2ff78e237365c6fa08e blob + df7bf0dab186cee47db6271b9a9a8be91a51a3b5 --- vostok/vostok.cc +++ vostok/vostok.cc @@ -7,6 +7,7 @@ #include "open_file.h" #include "gemini.h" +#include #include #include #include @@ -225,5 +226,6 @@ main(int argc, char *argv[]) if (!vostok::parse_command_line_arguments(argc, argv, args)) return 1; + signal(SIGPIPE, SIG_IGN); return vostok::main(args) ? 0 : 1; }