Re: Event sequense upon client disconnection

Giganews Newsgroups
Subject: Re: Event sequense upon client disconnection
Posted by:  Khash Sajadi (kha…
Date: Fri, 11 Mar 2005

Ok here is some more information on what's happening.

I have a custom built decendant of TStream called TMyStream. The problem
with this stream is that its .Write method is slow and there is nothing I
can do about it. Everything works fine when the client uploads a file and
waits for it to finish. But if the client gets disconnected in the middle of
the upload then we have problems.

As far as I could understand, when the client disconnects, OnDisconnect
event triggers and the Command channel thread gets disposed, which is fine.
Then the FTP server component tries to destroy the data channel but it is
still waiting for TMyStream.Write to finish its job and when it is done, I
get an AV at FDataChannel.Disconnect; in TIdDataChannelThread.Run of
I have no idea why this is happening as I don't do *anything* with the data
channel directly!

To stop this from happening, I moved KillDataChannel from the protected
section of TIdFTPServerThread to the public section and now I call it in
OnDisconnect event of the component. This seem to solve the issue. But now I
get a Connection Closed Gracefully exception in a dialog box at address
$0000000 with no reference in the code and no way to suppress. OnException
event of the component also receives this but I couldn't find any ways of
suppressing it.

Can anyone help please?

Do you think I can solve this problem by moving to Indy 10?

Thank you,


"Khash Sajadi" <kha…> wrote in message
> Hi All,
> Could someone please tell me the event firing sequence when a client is
> disconnected in the middle of the upload to a TldFTPServer?
> I need to perform some special tasks in case the connection is
> disconnected before upload is finished. I know that OnDisconnect gets
> fired but it has a TIdPeerThread as the parameter and I'm after an event
> that gets called before that with a TIdFTPServerThread instead.
> Any help is appreciated.
> Cheers,
> Khash


In response to

Event sequense upon client disconnection posted by Khash Sajadi on Wed, 9 Mar 2005