[sword-devel] curl library and download termination

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Mon Nov 2 10:35:27 MST 2009

On Fri, 30 Oct 2009, Troy A. Griffitts wrote:

> Thanks for the detailed analysis Eeli-- most appreciated.  If you have a
> chance to make the changes you suggest and determine they work better
> for you, I'd be happy to commit the delta.  Do you think this is
> something we can do without changing public class definitions, so we can
> keep it in the 1.6.x thread?  Looking briefly, I suppose we could:
> in getURL:
> - curl_easy_setopt(session, CURLOPT_PROGRESSDATA, statusReporter);
> + curl_easy_setopt(session, CURLOPT_PROGRESSDATA, this);
> in my_fprogress:
> - ((StatusReporter *)clientp)->statusUpdate(dltotal, dlnow);
> + ((CURLFTPTransport *)clientp)->statusReporter->statusUpdate(dltotal,
> dlnow);
> + return ((CURLFTPTransport *)clientp)->term;

These changes should be correct, and I don't find anything else to add
or change regarding the curl library.

However, I don't quite understand the return values of InstallMgr and
FTPTransport functions which indicate errors and user initiated abort.
I really recommend you document the classes, even private functions, and
take special care with return values. To me it looks like user initiated
abort and real errors are handled identically, so that it's not always
clear whether installation was cancelled or failed.

I'll try to implement and test the proposed changes, but it's quite hard
to say whether they really work 100% correctly in threads. Concurrency
related problems occur randomly, maybe in 5, 1 or 0.1% of cases.
Multicore or multiprocessor raises the fail % easily 10 or 100 times so
high. The changes should be tested also with other apps than BibleTime,
and there the other apps' developers should help. BibleTime developers
have to test the thread safety as much as they can. I recommend
installing a private local ftp server and testing with that.

	Eeli Kaikkonen (Mr.), Oulu, Finland
	e-mail: eekaikko at mailx.studentx.oulux.fix (with no x)

More information about the sword-devel mailing list