Abort logic fixes
This commit is contained in:
+1
-1
@@ -66,7 +66,7 @@ private:
|
||||
|
||||
std::cout << "Close event!" << std::endl;
|
||||
|
||||
/* Signal broken HTTP request */
|
||||
/* Signal broken HTTP request only if we have a pending request */
|
||||
if (httpResponseData->onAborted) {
|
||||
httpResponseData->onAborted();
|
||||
}
|
||||
|
||||
@@ -105,6 +105,13 @@ private:
|
||||
Super::timeout(HTTP_TIMEOUT_S);
|
||||
}
|
||||
|
||||
/* Remove onAborted function if we reach the end */
|
||||
if (httpResponseData->offset == totalSize) {
|
||||
httpResponseData->onAborted = nullptr;
|
||||
/* Also remove onWritable so that we do not emit when draining behind the scenes. */
|
||||
httpResponseData->onWritable = nullptr;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user