LibURL Error Previous request not completed

Dave Cragg dcragg at lacscentre.co.uk
Wed Aug 2 07:55:34 EDT 2006


On 2 Aug 2006, at 10:39, Mark Schonewille wrote:

> Hi Dave,
>
> Thanks for taking this up.
>
> I can't use the callback message to get a file listing, because the  
> user of my software may wish to upload hundreds, if not thousands,  
> of files at once. The callback message would be called hundreds of  
> times and if the callback message caused the directory listing to  
> update, I would probably run into serious trouble, calling getURL  
> hundreds of times.

But can't you use the callback handler to "check off" which files  
have been uploaded, and only get the directory listing when they have  
all been uploaded? Perhaps along the lines of this (very crude example):


local laFileTrackerArray

on massUpload pFileList, pSourceDirectory, pTargetDirectory
   ##pTargetDirectory is the url of the target directory
   repeat for each line tFile in pFileList

     put pSourceDirectory & tFile into tFrom
     put pTargetDirectory & tFile into tTo
     ## should probably check whether the local file exists

     put 1 into laFileTrackerArray[tTo]
     libUrlFtpUploadFile tFrom, tTo ,"trackUploads"
     ## should probably check the result here
   end repeat
end massUpload

on trackUploads pUrl, pStatus
    unload url pUrl
    delete local laFileTrackerArray[pUrl]
    if keys(laFileTrackerArray) is empty then
	## get the directory listing now
    end if
end trackUploads


> Can you explain what exactly causes the handlers in the library to  
> block each other? Maybe we can change it?

The blocking is intentional for so-called "blocking" calls (get,  
post, etc.). You can't make a blocking call until a previous one has  
completed. I don't think that behavior should be changed. But if it's  
not working as intended, then that's a diferent matter.

Cheers
Dave





More information about the use-livecode mailing list