RE: Aborting an FTP Stream
RE: Aborting an FTP Stream
- Subject: RE: Aborting an FTP Stream
- From: "Wells, Terry C" <email@hidden>
- Date: Mon, 28 Feb 2005 08:44:34 -0800
- Thread-topic: Aborting an FTP Stream
Title: RE: Aborting an FTP Stream
Hi,
After taking a fresh look at it this morning, I noticed that the cause of the crash was quite simple. The order of destruction when the cancel button was clicked was causing the CFNetwork CFBundle to get unloaded and all the function pointers NULLed out before the call to unschedule the stream from the run loop. Oops. That's an easy enough fix.
Now I can successfully unschedule, set client = 0, close the stream and release the stream.
However, I'm still having a problem. Now it doesn't crash, but the next thing that happens in my program is an FTP directory listing which reloads the CFNetwork bundle, sets up another transfer, and calls RunLoopRun again. On this call, something hangs internally and no FTP transfer ever occurs, thus the runloop never exits and my whole app is frozen.
Given that the directory listing works correctly in the case that the prior FTP transfer completes normally (ie. no cancel), I'm thinking that something is getting hosed up in the cancel/abort case.
Any ideas where to chase this one?
Thanks,
Terry
-----Original Message-----
From: email@hidden on behalf of Frederick Cheung
Sent: Sun 2/27/2005 2:09 AM
To: email@hidden
Cc: Wells, Terry C
Subject: Re: Aborting an FTP Stream
On 26 Feb 2005, at 20:06, email@hidden wrote:
> Date: Fri, 25 Feb 2005 14:29:40 -0800
> From: "Wells, Terry C" <email@hidden>
> Subject: Aborting an FTP Stream
> To: <email@hidden>
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> "I'm getting so close to having this FTP code running, I can taste
> it." (Famous last words)
>
> It would appear that the last remaining functional hurdle for me is
> the ability to abort an FTP transfer.
>
> The problem I'm having is that calling
> CFReadStreamUnscheduleFromRunLoop() from within the download callback
> while the transfer is still active causes an access exception.
>
> I haven't been able to locate anything like CFReadStreamAbort() or
> equivalent in the docs.
I do that in my code and have never had any problems.
Are you calling CFReadStreamSetClient(stream,NULL,NULL,NULL) before
unscheduling (and I presume closing and releasing your stream)?
Unscheduling from the run loop doesn't actually cancel anything, the
call that will actually tear down stuff is CFReadStreamClose
Fred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden