wjj_sohu
1999-08-29 03:34:08 UTC
In http_.cpp I found a possible error of HTTPConnection::HTTPRequest::m_bDocDone.
the fixed source code is in the following. It seems that if this is not changed, the main thread will create too much add_timeout().
Can some specialist tell me if my change is correct or not?
static void _CheckData(void * pt)
{
HTTPConnection * pThis = (HTTPConnection*)pt;
HTTPConnection::HTTPRequest * p = pThis->GetFinished();
while(p) {
if(!p->toss()) {
if(p->newPage()) {
p->HTML()->begin(p->getURL());
p->HTML()->write((const char*)p->getBuffer());
p->HTML()->end();
p->HTML()->parse();
p->HTML()->redraw();
/*wjj add it*/
pThis->m_bDocDone=true;
} else {
p->HTML()->data(p->getURL(), (const char *)p->getBuffer(),
p->getSize(), true);
/* wjj add it*/
pThis->m_bDocDone=true;
}
}
delete p;
p = pThis->GetFinished();
}
if(!pThis->m_bDocDone) {
Fl::add_timeout(.5, _CheckData, pt);
}
}
Best Regard
Wang JiangJiang
email: ***@sohu.com
the fixed source code is in the following. It seems that if this is not changed, the main thread will create too much add_timeout().
Can some specialist tell me if my change is correct or not?
static void _CheckData(void * pt)
{
HTTPConnection * pThis = (HTTPConnection*)pt;
HTTPConnection::HTTPRequest * p = pThis->GetFinished();
while(p) {
if(!p->toss()) {
if(p->newPage()) {
p->HTML()->begin(p->getURL());
p->HTML()->write((const char*)p->getBuffer());
p->HTML()->end();
p->HTML()->parse();
p->HTML()->redraw();
/*wjj add it*/
pThis->m_bDocDone=true;
} else {
p->HTML()->data(p->getURL(), (const char *)p->getBuffer(),
p->getSize(), true);
/* wjj add it*/
pThis->m_bDocDone=true;
}
}
delete p;
p = pThis->GetFinished();
}
if(!pThis->m_bDocDone) {
Fl::add_timeout(.5, _CheckData, pt);
}
}
Best Regard
Wang JiangJiang
email: ***@sohu.com