Re: development question
"Alexander V. Lukyanov" <[email protected]>
| Newsgroups | gmane.network.lftp.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Feb 08, 2005 at 12:06:52AM +0100, Tomasz Grobelny wrote:
> On Sunday 06 of February 2005 03:34, I wrote:
> > Thanks, for now it more or less works (using Parse, not GetResult). But I
> > have a strange problem: example2.cc as well as my program stall after
> > receiving some data. As I noticed for example2.cc it receives 2271 bytes
> > then waits for 60 seconds and finishes receiving data so that the resulting
> > file contains 2402 bytes. If I increase buffer size to 2048 bytes the
> > program reads all data at once but still stalls for 60 seconds before
> > finishing execution. What may cause the problem?
> >
> Does anybody experience such a problem?
Yes, I could reproduce it. Here is a patch for that example.
Index: example2.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/example2.cc,v
retrieving revision 1.4
diff -u -p -r1.4 example2.cc
--- example2.cc 4 Apr 2001 07:22:13 -0000 1.4
+++ example2.cc 8 Feb 2005 10:36:56 -0000
@@ -21,14 +21,16 @@ int main()
for(;;)
{
SMTask::Schedule();
- SMTask::Block();
char buf[1024];
int res=f->Read(buf,sizeof(buf));
if(res<0)
{
if(res==f->DO_AGAIN)
+ {
+ SMTask::Block();
continue;
+ }
fprintf(stderr,"Error: %s\n",f->StrError(res));
return 1;
}
--
Alexander.