PercentDone callback counts as an AbortCheck
Question:
“I’ve got the Chilkat C++ libs linked with my project, and am using the HTTP classes successfully.
One thing is confusing me, though. I’ve derived a class from CkHttpProgress.h and overridden AbortCheck(…) to provide cancellation support. However, AbortCheck(…) never gets called. At first, I thought perhaps the HTTP retrieval was occurring too quickly, so I set the “HeartbeatMs” property to “1”, and it still never gets called.
I know the assignment of the callback class is working, because if I override PercentDone(…), it does indeed get called.
Is it possible that my use of the HTTP QuickGetStr(…) method does not support the AbortCheck(…) callback? I’m (successfully) reading a small XML file from a web server in close proximity to the client.”
Answer:
The PercentDone callback method also has an “abort” argument, so it may also be used to abort a method while in progress. In cases where the PercentDone callback provides abort capability, it counts as an AbortCheck callback — to prevent too many callbacks from bombarding your application.
Therefore, if HeartbeatMs is set to 100ms, and a PercentDone callback is fired, then the timer for the next AbortCheck callback is reset. The entire operation could be short enough such that all of the callbacks are PercentDone callbacks, and AbortCheck never gets called. The AbortCheck callback would only be called when the elapsed time between 1% completion intervals exceeds the HeartbeatMs.
admin
0
Tags :