From 2b20af36a7843fee5b67c62cddea4459375ec69b Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Thu, 17 Aug 2023 16:45:10 -0300 Subject: [PATCH] is_closing -> is_draining --- examples/esp8266/http-client-server/src/main/main.c | 2 +- examples/http-client/main.c | 2 +- examples/http-streaming-client/main.c | 2 +- examples/mip-pcap/main.c | 2 +- examples/mqtt-over-ws-client/main.c | 4 ++-- examples/socks5-server/main.c | 2 +- examples/uart-bridge/net.c | 6 +++--- examples/zephyr/http-client/src/main.c | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/esp8266/http-client-server/src/main/main.c b/examples/esp8266/http-client-server/src/main/main.c index 55708e2a..8399f37d 100644 --- a/examples/esp8266/http-client-server/src/main/main.c +++ b/examples/esp8266/http-client-server/src/main/main.c @@ -27,7 +27,7 @@ static void cb2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { } else if (ev == MG_EV_HTTP_MSG) { struct mg_http_message *hm = ev_data; // Print HTTP response MG_INFO(("Fetched:\n%.*s", (int) hm->message.len, hm->message.ptr)); - c->is_closing = 1; + c->is_draining = 1; } } diff --git a/examples/http-client/main.c b/examples/http-client/main.c index 571b1fcf..90979189 100644 --- a/examples/http-client/main.c +++ b/examples/http-client/main.c @@ -43,7 +43,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { // Response is received. Print it struct mg_http_message *hm = (struct mg_http_message *) ev_data; printf("%.*s", (int) hm->message.len, hm->message.ptr); - c->is_closing = 1; // Tell mongoose to close this connection + c->is_draining = 1; // Tell mongoose to close this connection *(bool *) fn_data = true; // Tell event loop to stop } else if (ev == MG_EV_ERROR) { *(bool *) fn_data = true; // Error, tell event loop to stop diff --git a/examples/http-streaming-client/main.c b/examples/http-streaming-client/main.c index 40f78cfd..eef3eb99 100644 --- a/examples/http-streaming-client/main.c +++ b/examples/http-streaming-client/main.c @@ -39,7 +39,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { // Response is received. Print it struct mg_http_message *hm = (struct mg_http_message *) ev_data; fwrite(hm->body.ptr, 1, hm->body.len, stdout); - c->is_closing = 1; // Tell mongoose to close this connection + c->is_draining = 1; // Tell mongoose to close this connection *(bool *) fn_data = true; // Tell event loop to stop } else if (ev == MG_EV_ERROR) { *(bool *) fn_data = true; // Error, tell event loop to stop diff --git a/examples/mip-pcap/main.c b/examples/mip-pcap/main.c index 48f4ef61..81935ad4 100644 --- a/examples/mip-pcap/main.c +++ b/examples/mip-pcap/main.c @@ -47,7 +47,7 @@ static void fn2(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { struct mg_http_message *hm = (struct mg_http_message *) ev_data; MG_DEBUG(("Got response (%d) %.*s...", (int) hm->message.len, 12, hm->message.ptr)); - c->is_closing = 1; + c->is_draining = 1; } else if (ev == MG_EV_CONNECT) { mg_printf(c, "GET %s HTTP/1.1\r\n\r\n", mg_url_uri((char *) fn_data)); } else if (ev == MG_EV_CLOSE) { diff --git a/examples/mqtt-over-ws-client/main.c b/examples/mqtt-over-ws-client/main.c index c91eaae9..feaa5275 100644 --- a/examples/mqtt-over-ws-client/main.c +++ b/examples/mqtt-over-ws-client/main.c @@ -66,7 +66,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { len = mg_ws_wrap(c, c->send.len - len, WEBSOCKET_OP_BINARY); } else { MG_ERROR(("%lu MQTT auth failed, code %d", c->id, mm.ack)); - c->is_closing = 1; + c->is_draining = 1; } break; case MQTT_CMD_PUBLISH: { @@ -74,7 +74,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { mm.topic.ptr, (int) mm.data.len, mm.data.ptr)); MG_INFO(("RECEIVED %.*s <- %.*s", (int) mm.data.len, mm.data.ptr, (int) mm.topic.len, mm.topic.ptr)); - c->is_closing = 1; + c->is_draining = 1; break; } } diff --git a/examples/socks5-server/main.c b/examples/socks5-server/main.c index 53f66d88..bcdc862d 100644 --- a/examples/socks5-server/main.c +++ b/examples/socks5-server/main.c @@ -44,7 +44,7 @@ enum { static void handshake(struct mg_connection *c) { struct mg_iobuf *r = &c->recv; if (r->buf[0] != VERSION) { - c->is_closing = 1; + c->is_draining = 1; } else if (r->len > 2 && (size_t) r->buf[1] + 2 <= r->len) { /* https://www.ietf.org/rfc/rfc1928.txt paragraph 3 */ uint8_t reply[2] = {VERSION, HANDSHAKE_FAILURE}; diff --git a/examples/uart-bridge/net.c b/examples/uart-bridge/net.c index e59e42c7..91b7aecc 100644 --- a/examples/uart-bridge/net.c +++ b/examples/uart-bridge/net.c @@ -181,9 +181,9 @@ static void config_apply(struct mg_str s) { if (mg_json_get_num(s, "$.tx", &v)) s_state.tx = (int) v; if (mg_json_get_num(s, "$.baud", &v)) s_state.baud = (int) v; - if (s_state.mqtt.c) s_state.mqtt.c->is_closing = 1; - if (s_state.tcp.c) s_state.tcp.c->is_closing = 1; - if (s_state.websocket.c) s_state.websocket.c->is_closing = 1; + if (s_state.mqtt.c) s_state.mqtt.c->is_draining = 1; + if (s_state.tcp.c) s_state.tcp.c->is_draining = 1; + if (s_state.websocket.c) s_state.websocket.c->is_draining = 1; } // HTTP request handler function diff --git a/examples/zephyr/http-client/src/main.c b/examples/zephyr/http-client/src/main.c index cd5bb734..f7c828fb 100644 --- a/examples/zephyr/http-client/src/main.c +++ b/examples/zephyr/http-client/src/main.c @@ -48,7 +48,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { // Response is received. Print it struct mg_http_message *hm = (struct mg_http_message *) ev_data; MG_INFO(("%.*s", (int) hm->message.len, hm->message.ptr)); - c->is_closing = 1; // Tell mongoose to close this connection + c->is_draining = 1; // Tell mongoose to close this connection *(bool *) fn_data = true; // Tell event loop to stop } else if (ev == MG_EV_ERROR) { *(bool *) fn_data = true; // Error, tell event loop to stop