mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-26 16:29:36 +03:00
Fix backend fetcher poll loops
svn path=/trunk/netsurf/; revision=11775
This commit is contained in:
parent
79d9d6abab
commit
308f549f78
@ -353,10 +353,6 @@ static void fetch_about_poll(const char *scheme)
|
||||
/* Iterate over ring, processing each pending fetch */
|
||||
c = ring;
|
||||
do {
|
||||
/* Take a copy of the next pointer as we may destroy
|
||||
* the ring item we're currently processing */
|
||||
next = c->r_next;
|
||||
|
||||
/* Ignore fetches that have been flagged as locked.
|
||||
* This allows safe re-entrant calls to this function.
|
||||
* Re-entrancy can occur if, as a result of a callback,
|
||||
@ -364,6 +360,7 @@ static void fetch_about_poll(const char *scheme)
|
||||
* again.
|
||||
*/
|
||||
if (c->locked == true) {
|
||||
next = c->r_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -373,6 +370,10 @@ static void fetch_about_poll(const char *scheme)
|
||||
c->handler(c);
|
||||
}
|
||||
|
||||
/* Compute next fetch item at the last possible moment
|
||||
* as processing this item may have added to the ring
|
||||
*/
|
||||
next = c->r_next;
|
||||
|
||||
fetch_remove_from_queues(c->fetchh);
|
||||
fetch_free(c->fetchh);
|
||||
|
@ -235,10 +235,6 @@ static void fetch_data_poll(const char *scheme)
|
||||
/* Iterate over ring, processing each pending fetch */
|
||||
c = ring;
|
||||
do {
|
||||
/* Take a copy of the next pointer as we may destroy
|
||||
* the ring item we're currently processing */
|
||||
next = c->r_next;
|
||||
|
||||
/* Ignore fetches that have been flagged as locked.
|
||||
* This allows safe re-entrant calls to this function.
|
||||
* Re-entrancy can occur if, as a result of a callback,
|
||||
@ -246,11 +242,12 @@ static void fetch_data_poll(const char *scheme)
|
||||
* again.
|
||||
*/
|
||||
if (c->locked == true) {
|
||||
next = c->r_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Only process non-aborted fetches */
|
||||
if (!c->aborted && fetch_data_process(c) == true) {
|
||||
if (c->aborted == false && fetch_data_process(c) == true) {
|
||||
char header[64];
|
||||
|
||||
fetch_set_http_code(c->parent_fetch, 200);
|
||||
@ -265,17 +262,22 @@ static void fetch_data_poll(const char *scheme)
|
||||
fetch_data_send_callback(FETCH_HEADER, c, header,
|
||||
strlen(header), FETCH_ERROR_NO_ERROR);
|
||||
|
||||
snprintf(header, sizeof header, "Content-Length: %zd",
|
||||
if (c->aborted == false) {
|
||||
snprintf(header, sizeof header,
|
||||
"Content-Length: %zd",
|
||||
c->datalen);
|
||||
fetch_data_send_callback(FETCH_HEADER, c, header,
|
||||
strlen(header), FETCH_ERROR_NO_ERROR);
|
||||
fetch_data_send_callback(FETCH_HEADER, c,
|
||||
header, strlen(header),
|
||||
FETCH_ERROR_NO_ERROR);
|
||||
}
|
||||
|
||||
if (!c->aborted) {
|
||||
if (c->aborted == false) {
|
||||
fetch_data_send_callback(FETCH_DATA,
|
||||
c, c->data, c->datalen,
|
||||
FETCH_ERROR_NO_ERROR);
|
||||
}
|
||||
if (!c->aborted) {
|
||||
|
||||
if (c->aborted == false) {
|
||||
fetch_data_send_callback(FETCH_FINISHED,
|
||||
c, 0, 0, FETCH_ERROR_NO_ERROR);
|
||||
}
|
||||
@ -288,6 +290,11 @@ static void fetch_data_poll(const char *scheme)
|
||||
assert(c->locked == false);
|
||||
}
|
||||
|
||||
/* Compute next fetch item at the last possible moment as
|
||||
* processing this item may have added to the ring.
|
||||
*/
|
||||
next = c->r_next;
|
||||
|
||||
fetch_remove_from_queues(c->parent_fetch);
|
||||
fetch_free(c->parent_fetch);
|
||||
|
||||
|
@ -599,10 +599,6 @@ static void fetch_file_poll(const char *scheme)
|
||||
/* Iterate over ring, processing each pending fetch */
|
||||
c = ring;
|
||||
do {
|
||||
/* Take a copy of the next pointer as we may destroy
|
||||
* the ring item we're currently processing */
|
||||
next = c->r_next;
|
||||
|
||||
/* Ignore fetches that have been flagged as locked.
|
||||
* This allows safe re-entrant calls to this function.
|
||||
* Re-entrancy can occur if, as a result of a callback,
|
||||
@ -610,6 +606,7 @@ static void fetch_file_poll(const char *scheme)
|
||||
* again.
|
||||
*/
|
||||
if (c->locked == true) {
|
||||
next = c->r_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -619,6 +616,10 @@ static void fetch_file_poll(const char *scheme)
|
||||
fetch_file_process(c);
|
||||
}
|
||||
|
||||
/* Compute next fetch item at the last possible moment as
|
||||
* processing this item may have added to the ring.
|
||||
*/
|
||||
next = c->r_next;
|
||||
|
||||
fetch_remove_from_queues(c->fetchh);
|
||||
fetch_free(c->fetchh);
|
||||
|
@ -234,10 +234,6 @@ static void fetch_resource_poll(const char *scheme)
|
||||
/* Iterate over ring, processing each pending fetch */
|
||||
c = ring;
|
||||
do {
|
||||
/* Take a copy of the next pointer as we may destroy
|
||||
* the ring item we're currently processing */
|
||||
next = c->r_next;
|
||||
|
||||
/* Ignore fetches that have been flagged as locked.
|
||||
* This allows safe re-entrant calls to this function.
|
||||
* Re-entrancy can occur if, as a result of a callback,
|
||||
@ -245,6 +241,7 @@ static void fetch_resource_poll(const char *scheme)
|
||||
* again.
|
||||
*/
|
||||
if (c->locked == true) {
|
||||
next = c->r_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -254,6 +251,10 @@ static void fetch_resource_poll(const char *scheme)
|
||||
c->handler(c);
|
||||
}
|
||||
|
||||
/* Compute next fetch item at the last possible moment
|
||||
* as processing this item may have added to the ring
|
||||
*/
|
||||
next = c->r_next;
|
||||
|
||||
fetch_remove_from_queues(c->fetchh);
|
||||
fetch_free(c->fetchh);
|
||||
|
Loading…
Reference in New Issue
Block a user