Commit 8c2e641e authored by Alexander Alashkin's avatar Alexander Alashkin Committed by Cesanta Bot

Simplest c_hello/stm32

PUBLISHED_FROM=3a22eb96ff011ef8327cd1b78b56a3af86ba2c84
parent 29c53082
...@@ -2050,7 +2050,9 @@ MG_INTERNAL void mg_add_conn(struct mg_mgr *mgr, struct mg_connection *c) { ...@@ -2050,7 +2050,9 @@ MG_INTERNAL void mg_add_conn(struct mg_mgr *mgr, struct mg_connection *c) {
mgr->active_connections = c; mgr->active_connections = c;
c->prev = NULL; c->prev = NULL;
if (c->next != NULL) c->next->prev = c; if (c->next != NULL) c->next->prev = c;
if (c->sock != INVALID_SOCKET) {
c->iface->vtable->add_conn(c); c->iface->vtable->add_conn(c);
}
} }
MG_INTERNAL void mg_remove_conn(struct mg_connection *conn) { MG_INTERNAL void mg_remove_conn(struct mg_connection *conn) {
...@@ -2960,7 +2962,9 @@ double mg_set_timer(struct mg_connection *c, double timestamp) { ...@@ -2960,7 +2962,9 @@ double mg_set_timer(struct mg_connection *c, double timestamp) {
} }
void mg_sock_set(struct mg_connection *nc, sock_t sock) { void mg_sock_set(struct mg_connection *nc, sock_t sock) {
if (sock != INVALID_SOCKET) {
nc->iface->vtable->sock_set(nc, sock); nc->iface->vtable->sock_set(nc, sock);
}
} }
void mg_if_get_conn_addr(struct mg_connection *nc, int remote, void mg_if_get_conn_addr(struct mg_connection *nc, int remote,
...@@ -13275,7 +13279,7 @@ time_t mg_sl_if_poll(struct mg_iface *iface, int timeout_ms) { ...@@ -13275,7 +13279,7 @@ time_t mg_sl_if_poll(struct mg_iface *iface, int timeout_ms) {
struct SlTimeval_t tv; struct SlTimeval_t tv;
SlFdSet_t read_set, write_set, err_set; SlFdSet_t read_set, write_set, err_set;
sock_t max_fd = INVALID_SOCKET; sock_t max_fd = INVALID_SOCKET;
int num_fds, num_ev, num_timers = 0; int num_fds, num_ev = 0, num_timers = 0;
SL_FD_ZERO(&read_set); SL_FD_ZERO(&read_set);
SL_FD_ZERO(&write_set); SL_FD_ZERO(&write_set);
...@@ -13330,7 +13334,10 @@ time_t mg_sl_if_poll(struct mg_iface *iface, int timeout_ms) { ...@@ -13330,7 +13334,10 @@ time_t mg_sl_if_poll(struct mg_iface *iface, int timeout_ms) {
tv.tv_sec = timeout_ms / 1000; tv.tv_sec = timeout_ms / 1000;
tv.tv_usec = (timeout_ms % 1000) * 1000; tv.tv_usec = (timeout_ms % 1000) * 1000;
if (num_fds > 0) {
num_ev = sl_Select((int) max_fd + 1, &read_set, &write_set, &err_set, &tv); num_ev = sl_Select((int) max_fd + 1, &read_set, &write_set, &err_set, &tv);
}
now = mg_time(); now = mg_time();
DBG(("sl_Select @ %ld num_ev=%d of %d, timeout=%d", (long) now, num_ev, DBG(("sl_Select @ %ld num_ev=%d of %d, timeout=%d", (long) now, num_ev,
num_fds, timeout_ms)); num_fds, timeout_ms));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment