Re: Problem with TIdFTP.List, Indy 9, Delphi 7

Giganews Newsgroups
Subject: Re: Problem with TIdFTP.List, Indy 9, Delphi 7
Posted by:  Ulf Jaenicke-Rößler (u…
Date: Thu, 05 Oct 2006 schrieb:

> With that change, the program now literally hangs when i call TIdFTP.List.


seems as if a new bug has been introduced. I noticed the same thing and
was able to fix it by changing IdTCPConnection.pas:

In TIdTCPConnection.ReadStream, after line 747
          on E: Exception do begin
            // RLebeau - ReadFromStack() inside of ReadBuffer()
            // could have filled the InputBuffer with more bytes
            // than actually requested, so don't extract too
            // many bytes here...
            i := Min(i, InputBuffer.Size);
=> here!

            if i=0 then

This breaks the while loop, as soon as all data has been read. In
earlier versions this
break came from the call to Connected, which had been commented by RLebeau:

Starting from line 729 it reads:
    // RLebeau - don't call Connected() here!  ReadBuffer() already
    // does that internally. Calling Connected() here can cause an
    // EIdConnClosedGracefully exception that breaks the loop
    // prematurely and thus leave unread bytes in the InputBuffer.
    // Let the loop catch the exception before exiting...
    while {Connected and} (LWorkCount > 0) do begin


In response to

Problem with TIdFTP.List, Indy 9, Delphi 7 posted by on Mon, 31 Jul 2006