mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 20:27:43 +03:00
fix spider core
This commit is contained in:
parent
5fcfff6729
commit
5cdb73bc70
20
Msg13.cpp
20
Msg13.cpp
@ -2186,16 +2186,25 @@ void gotIframeExpandedContent ( void *state ) {
|
||||
// we respect crawl delay for sure
|
||||
void scanHammerQueue ( int fd , void *state ) {
|
||||
|
||||
Msg13Request *r = s_hammerQueueHead;
|
||||
if ( ! r ) return;
|
||||
if ( ! s_hammerQueueHead ) return;
|
||||
|
||||
long long nowms = gettimeofdayInMilliseconds();
|
||||
|
||||
top:
|
||||
|
||||
Msg13Request *r = s_hammerQueueHead;
|
||||
if ( ! r ) return;
|
||||
|
||||
Msg13Request *prev = NULL;
|
||||
long long waited = -1LL;
|
||||
Msg13Request *nextLink = NULL;
|
||||
|
||||
// scan down the linked list of queued of msg13 requests
|
||||
for ( ; r ; prev = r , r = r->m_nextLink ) {
|
||||
for ( ; r ; prev = r , r = nextLink ) {
|
||||
|
||||
// downloadTheDocForReals() could free "r" so save this here
|
||||
nextLink = r->m_nextLink;
|
||||
|
||||
long long last;
|
||||
last = s_hammerCache.getLongLong(0,r->m_firstIp,30,true);
|
||||
// is one from this ip outstanding?
|
||||
@ -2224,6 +2233,11 @@ void scanHammerQueue ( int fd , void *state ) {
|
||||
if ( s_hammerQueueTail == r )
|
||||
s_hammerQueueTail = prev;
|
||||
|
||||
// if "r" was freed by downloadTheDocForReals() then
|
||||
// in the next iteration of this loop, "prev" will point
|
||||
// to a freed memory area, so start from the top again
|
||||
goto top;
|
||||
|
||||
// try to download some more i guess...
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user