[capy] error codes

Andrzej Krzemienski via Boost <[email protected]> Wed, 1 Jul 2026 00:48:54 +0200
Newsgroups gmane.comp.lib.boost.devel
Message-ID <CAOenAXjo4X10F_yzwqGoVRGc74n65oD8U=xSm=gj+FBpP5X28g@mail.gmail.com>
Hi Everyone,
Stream operations often return error codes (they still throw exceptions)
and I am trying to wrap my head around how they can be processed.

Functions pull_from and push_to special-case on cond::eof. So do a number
of examples in the docs. Why only this one? I have been told that
cond::stream_truncated means "end of file, transmission ended before the
handshake, may be a truncation attack, may be a safe  end, judge yourself."
How can users make this call when some Capy functions already discard it?

BTW, looking at the implementation of pull_from and push_to, when an error
is reported, there is no way to figure out from which stream it originated.

Looking at the implementation in normalize_openssl_shutdown_read_error in
Corosio, it looks like when we decide to stop a task reading an SSL stream
we will not get cond::canceled, but instead we may get
cond::stream_truncated. This is the only place where -- against the
protocol -- we do not get the feedback that the operation was canceled as
requested.

BTW, cond::canceled detects two things: a successfully processed
cancellation request (error::canceled) and other events, possibly caused by
the state of the socket at the other end.(std::errc::operation_canceled).
It is not a practical condition.

Regards,
&rzej;
_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/HBFLMZ2TJCAODMUSQ22VPFTGPYEVPKYB/