Remove unused MG_F_DONT_SEND

PUBLISHED_FROM=beaec58b808fb767b7e491d8b5d6b23a6d5e4e0c
This commit is contained in:
Sergey Lyubka 2015-11-15 20:34:40 +00:00
parent c09ba40a48
commit 46529fd51e
2 changed files with 10 additions and 14 deletions

View File

@ -1803,7 +1803,7 @@ void to_wchar(const char *path, wchar_t *wbuf, size_t wbuf_len) {
#define _MG_CALLBACK_MODIFIABLE_FLAGS_MASK \ #define _MG_CALLBACK_MODIFIABLE_FLAGS_MASK \
(MG_F_USER_1 | MG_F_USER_2 | MG_F_USER_3 | MG_F_USER_4 | MG_F_USER_5 | \ (MG_F_USER_1 | MG_F_USER_2 | MG_F_USER_3 | MG_F_USER_4 | MG_F_USER_5 | \
MG_F_USER_6 | MG_F_WEBSOCKET_NO_DEFRAG | MG_F_SEND_AND_CLOSE | \ MG_F_USER_6 | MG_F_WEBSOCKET_NO_DEFRAG | MG_F_SEND_AND_CLOSE | \
MG_F_DONT_SEND | MG_F_CLOSE_IMMEDIATELY | MG_F_IS_WEBSOCKET) MG_F_CLOSE_IMMEDIATELY | MG_F_IS_WEBSOCKET)
#ifndef intptr_t #ifndef intptr_t
#define intptr_t long #define intptr_t long
@ -3080,8 +3080,7 @@ void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, time_t now) {
if (nc->flags & MG_F_CLOSE_IMMEDIATELY) return; if (nc->flags & MG_F_CLOSE_IMMEDIATELY) return;
} }
if ((fd_flags & _MG_F_FD_CAN_WRITE) && !(nc->flags & MG_F_DONT_SEND) && if ((fd_flags & _MG_F_FD_CAN_WRITE) && nc->send_mbuf.len > 0) {
nc->send_mbuf.len > 0) {
mg_write_to_socket(nc); mg_write_to_socket(nc);
} }
@ -3159,8 +3158,7 @@ void mg_ev_mgr_epoll_set_flags(const struct mg_connection *nc,
if ((nc->flags & MG_F_LISTENING) || nc->recv_mbuf.len < nc->recv_mbuf_limit) { if ((nc->flags & MG_F_LISTENING) || nc->recv_mbuf.len < nc->recv_mbuf_limit) {
ev->events |= EPOLLIN; ev->events |= EPOLLIN;
} }
if ((nc->flags & MG_F_CONNECTING) || if ((nc->flags & MG_F_CONNECTING) || (nc->send_mbuf.len > 0)) {
(nc->send_mbuf.len > 0 && !(nc->flags & MG_F_DONT_SEND))) {
ev->events |= EPOLLOUT; ev->events |= EPOLLOUT;
} }
} }
@ -3345,8 +3343,7 @@ time_t mg_mgr_poll(struct mg_mgr *mgr, int milli) {
} }
if (((nc->flags & MG_F_CONNECTING) && !(nc->flags & MG_F_WANT_READ)) || if (((nc->flags & MG_F_CONNECTING) && !(nc->flags & MG_F_WANT_READ)) ||
(nc->send_mbuf.len > 0 && !(nc->flags & MG_F_CONNECTING) && (nc->send_mbuf.len > 0 && !(nc->flags & MG_F_CONNECTING))) {
!(nc->flags & MG_F_DONT_SEND))) {
mg_add_to_set(nc->sock, &write_set, &max_fd); mg_add_to_set(nc->sock, &write_set, &max_fd);
mg_add_to_set(nc->sock, &err_set, &max_fd); mg_add_to_set(nc->sock, &err_set, &max_fd);
} }
@ -5835,11 +5832,11 @@ static void cgi_ev_handler(struct mg_connection *cgi_nc, int ev,
* which changes CODE to 302. * which changes CODE to 302.
* *
* Therefore we do not send the output from the CGI script to the user * Therefore we do not send the output from the CGI script to the user
* until all CGI headers are parsed (by setting MG_F_DONT_SEND flag). * until all CGI headers are received.
* *
* Here we parse the output from the CGI script, and if all headers has * Here we parse the output from the CGI script, and if all headers has
* been received, amend the reply line, and clear MG_F_DONT_SEND flag, * been received, send appropriate reply line, and forward all
* which makes data to be sent to the user. * received headers to the client.
*/ */
if (nc->flags & MG_F_USER_1) { if (nc->flags & MG_F_USER_1) {
struct mbuf *io = &cgi_nc->recv_mbuf; struct mbuf *io = &cgi_nc->recv_mbuf;

View File

@ -717,10 +717,9 @@ struct mg_connection {
/* Flags that are settable by user */ /* Flags that are settable by user */
#define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */ #define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */
#define MG_F_DONT_SEND (1 << 11) /* Do not send data to peer */ #define MG_F_CLOSE_IMMEDIATELY (1 << 11) /* Disconnect */
#define MG_F_CLOSE_IMMEDIATELY (1 << 12) /* Disconnect */ #define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12) /* Websocket specific */
#define MG_F_WEBSOCKET_NO_DEFRAG (1 << 13) /* Websocket specific */ #define MG_F_DELETE_CHUNK (1 << 13) /* HTTP specific */
#define MG_F_DELETE_CHUNK (1 << 14) /* HTTP specific */
#define MG_F_USER_1 (1 << 20) /* Flags left for application */ #define MG_F_USER_1 (1 << 20) /* Flags left for application */
#define MG_F_USER_2 (1 << 21) #define MG_F_USER_2 (1 << 21)