Skip to content

Commit

Permalink
refine fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
portl4t committed May 31, 2015
1 parent 7e16181 commit 099c477
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/ts_fetcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ ts_http_fetcher_create(TSCont contp, struct sockaddr *addr, int flags)
fch->chunked = 0;
fch->error = 0;
fch->launched = 0;
fch->stopped = 0;

return fch;
}
Expand Down Expand Up @@ -530,9 +531,16 @@ ts_http_fetcher_callback_sm(http_fetcher *fch, TSEvent event)
return -1;
}

if (event == TS_EVENT_FETCH_BODY_QUIET)
if (event == TS_EVENT_FETCH_BODY_QUIET || fch->stopped) {
return 0;

} else if (event != TS_EVENT_FETCH_HEADER_DONE &&
event != TS_EVENT_FETCH_BODY_READY &&
event != TS_EVENT_FETCH_BODY_QUIET) {

fch->stopped = 1;
}

fch->ref++;

if (fch->flags & TS_FLAG_FETCH_USE_NEW_LOCK)
Expand Down
1 change: 1 addition & 0 deletions src/lib/ts_fetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ typedef struct {
unsigned chunked:1;
unsigned error:1;
unsigned launched:1;
unsigned stopped:1;
// unsigned init_with_str:1;
} http_fetcher;

Expand Down

0 comments on commit 099c477

Please sign in to comment.