input/async: add attribute "postponed_exception"

Will replace "postponed_error".
This commit is contained in:
Max Kellermann
2016-09-09 15:41:09 +02:00
parent 6ed77f2a27
commit 8092e18158
2 changed files with 11 additions and 0 deletions

View File

@@ -88,6 +88,12 @@ AsyncInputStream::Resume()
bool
AsyncInputStream::Check(Error &error)
{
if (postponed_exception) {
auto e = std::move(postponed_exception);
postponed_exception = std::exception_ptr();
std::rethrow_exception(e);
}
bool success = !postponed_error.IsDefined();
if (!success) {
error = std::move(postponed_error);
@@ -181,6 +187,7 @@ bool
AsyncInputStream::IsAvailable()
{
return postponed_error.IsDefined() ||
postponed_exception ||
IsEOF() ||
!buffer.IsEmpty();
}