Howdy,
I've got a set of code that requires me to make an upload to an FTP site inside the NSModalPanelRunLoopMode, which is making things all sorts of fun :)
Currently I'm using CURLHandle, but it's far to basic as we need to do both uploads and deletions, along with atomic progress updates to the displayed NSProgressIndicator. I've tried ConnectionKit, but that's so geared towards async IO on the application's default run loop, I couldn't get it to work for the life of me inside my modal panel's run loop.
"Ideally" I would like to modify the CFFTPSample code ( http://developer.apple.com/samplecode/CFFTPSample/) to operate from within my NSThread detached inside the modal panel run loop. After my initial attempt I found that the CFWriteStream callback (for handling the has-bytes events, etc) was never being called.
I'm relatively certain that calling: CFWriteStreamScheduleWithRunLoop(writeStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes); should be scheduling the stream events on the modal panel's runloop, but stepping through the code shows that the first function (in this case MySimpleUpload()) returns immediately and the stream events never seem to be scheduled on the current run loop.
CFRunLoopGetCurrent() will report the thread's or the modal panel's runloop correct? Are there any caveats I should know about for trying to schedule events on a "special" run loop? I should just be able to schedule those CFWriteStream events on my modal panel and then let CFRunLoopRun() correct?
I'm asking more for validation before I rip out this current network code in favor of a more CFNetwork alternative (this will mark the third time this code has been rewritten -_-)
Suggestions welcome :)
Cheers |