Rename fcgi_request.closed to .ended

"closed" refers to whether FCGI_END_REQUEST has been sent, while
the "close" operation does something entirely different. It gets
extra confusing when fcgi_is_closed() does not actually return
fcgi_request.closed...
This commit is contained in:
Nikita Popov 2017-01-07 22:42:45 +01:00
parent 2cb8950cc2
commit f346bd6ee6
2 changed files with 7 additions and 7 deletions

View file

@ -216,7 +216,7 @@ struct _fcgi_request {
#ifdef TCP_NODELAY
int nodelay;
#endif
int closed;
int ended;
int in_len;
int in_pad;
@ -1045,7 +1045,7 @@ static int fcgi_read_request(fcgi_request *req)
unsigned char buf[FCGI_MAX_LENGTH+8];
req->keep = 0;
req->closed = 0;
req->ended = 0;
req->in_len = 0;
req->out_hdr = NULL;
req->out_pos = req->out_buf;
@ -1503,7 +1503,7 @@ static inline void close_packet(fcgi_request *req)
}
}
int fcgi_flush(fcgi_request *req, int close)
int fcgi_flush(fcgi_request *req, int end)
{
int len;
@ -1511,7 +1511,7 @@ int fcgi_flush(fcgi_request *req, int close)
len = (int)(req->out_pos - req->out_buf);
if (close) {
if (end) {
fcgi_end_request_rec *rec = (fcgi_end_request_rec*)(req->out_pos);
fcgi_make_header(&rec->hdr, FCGI_END_REQUEST, req->id, sizeof(fcgi_end_request));
@ -1650,9 +1650,9 @@ int fcgi_finish_request(fcgi_request *req, int force_close)
int ret = 1;
if (req->fd >= 0) {
if (!req->closed) {
if (!req->ended) {
ret = fcgi_flush(req, 1);
req->closed = 1;
req->ended = 1;
}
fcgi_close(req, force_close, 1);
}

View file

@ -118,7 +118,7 @@ void fcgi_loadenv(fcgi_request *req, fcgi_apply_func load_func, zval *array);
int fcgi_read(fcgi_request *req, char *str, int len);
int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int len);
int fcgi_flush(fcgi_request *req, int close);
int fcgi_flush(fcgi_request *req, int end);
#ifdef PHP_WIN32
void fcgi_impersonate(void);