2003-02-12 03:55:42 -03:00
|
|
|
|
|
|
|
#include <ngx_config.h>
|
|
|
|
|
|
|
|
#include <ngx_core.h>
|
|
|
|
#include <ngx_types.h>
|
|
|
|
#include <ngx_alloc.h>
|
|
|
|
#include <ngx_array.h>
|
|
|
|
#include <ngx_hunk.h>
|
|
|
|
#include <ngx_connection.h>
|
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
|
|
|
|
ngx_chain_t *(*ngx_write_chain_proc)(ngx_connection_t *c, ngx_chain_t *in);
|
2003-02-12 03:55:42 -03:00
|
|
|
|
|
|
|
|
|
|
|
ngx_chain_t *ngx_write_chain(ngx_connection_t *c, ngx_chain_t *in, off_t flush)
|
|
|
|
{
|
2003-02-26 17:21:43 -03:00
|
|
|
#if (NGX_EVENT)
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
return (*ngx_write_chain_proc)(c, in);
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
#elif (NGX_EVENT_THREAD)
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
off_t sent;
|
|
|
|
ngx_chain_t *rc;
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
sent = flush - c->sent;
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
do {
|
|
|
|
rc = (*ngx_write_chain_proc)(c, in);
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
if (rc == NGX_CHAIN_ERROR && rc == NULL) {
|
|
|
|
return rc;
|
2003-02-12 03:55:42 -03:00
|
|
|
}
|
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
} while (c->thread && flush > c->sent - sent);
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
#else
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
ngx_chain_t *rc;
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
do {
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
rc = (*ngx_write_chain_proc)(c, in);
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
} while (rc != NGX_CHAIN_ERROR && rc != NULL);
|
2003-02-12 03:55:42 -03:00
|
|
|
|
2003-02-26 17:21:43 -03:00
|
|
|
return rc;
|
2003-02-12 03:55:42 -03:00
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|