mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-21 01:13:43 +08:00
ns_server_poll() waking up by ns_server_wakeup()
This commit is contained in:
parent
0a3cb63c73
commit
df5e997ea7
@ -767,6 +767,7 @@ int ns_server_poll(struct ns_server *server, int milli) {
|
||||
FD_ZERO(&read_set);
|
||||
FD_ZERO(&write_set);
|
||||
ns_add_to_set(server->listening_sock, &read_set, &max_fd);
|
||||
ns_add_to_set(server->ctl[1], &read_set, &max_fd);
|
||||
|
||||
for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
|
||||
tmp_conn = conn->next;
|
||||
@ -797,6 +798,14 @@ int ns_server_poll(struct ns_server *server, int milli) {
|
||||
}
|
||||
}
|
||||
|
||||
// Read possible wakeup calls
|
||||
if (server->ctl[1] != INVALID_SOCKET &&
|
||||
FD_ISSET(server->ctl[1], &read_set)) {
|
||||
unsigned char ch;
|
||||
recv(server->ctl[1], &ch, 1, 0);
|
||||
send(server->ctl[1], &ch, 1, 0);
|
||||
}
|
||||
|
||||
for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
|
||||
tmp_conn = conn->next;
|
||||
if (FD_ISSET(conn->sock, &read_set)) {
|
||||
|
Loading…
Reference in New Issue
Block a user