commit 3499712b1b7c25c2508044f857ab80055d878e52 from: Aleksey Ryndin date: Sat Apr 20 13:40:49 2024 UTC Add: more logs commit - 9c066781cbe07d00c86d7e86b65c9c6b6bdea02a commit + 3499712b1b7c25c2508044f857ab80055d878e52 blob - b3f83890c4effab7d20d410118e4c18cd4ad7214 blob + 7421e7e61bd03408033cc994362ed5e6ca6ffd13 --- vostok/transport.cc +++ vostok/transport.cc @@ -31,25 +31,16 @@ class ConfigPtr : public ConfigPtrBase (public) class PrintIfError { public: - explicit PrintIfError(czstring error, const ssize_t *pret=nullptr) - : m_error{error} - , m_pret{pret} - { - } + explicit PrintIfError(czstring error) : m_error{error} {} void operator() () const { - if (m_pret) - error::g_log << "Return value: " << std::dec << *m_pret; - if (m_pret && m_error) - error::g_log << ". "; if (m_error) error::g_log << "Error: " << m_error; } private: czstring m_error; - const ssize_t *m_pret; }; @@ -189,13 +180,17 @@ send( auto ret = tls_write(ctx, buff.begin(), buff.size()); if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) continue; - if ((ret == 0) || (ret == -1)) + if (ret == -1) { - error::occurred("TLS write", PrintIfError{tls_error(ctx), &ret}); + error::occurred("TLS write", PrintIfError{tls_error(ctx)}); return false; } buff = buff.subspan(ret); + if (buff.size() <= 0) + break; + + error::g_log << "tls_write() == " << std::dec << ret << " "; } return true; }