mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-29 08:19:42 +08:00
Fix COAP example, reduce number of ctx switches
PUBLISHED_FROM=7010fff404826c3dfc783d2cbdcbd0936a8a2b85
This commit is contained in:
parent
3c53909e82
commit
f05733da69
@ -33,8 +33,7 @@ static void coap_handler(struct mg_connection *nc, int ev, void *p) {
|
||||
case MG_EV_COAP_ACK:
|
||||
case MG_EV_COAP_RST: {
|
||||
struct mg_coap_message *cm = (struct mg_coap_message *) p;
|
||||
printf("ACK/RST for message with msg_id = %d received\n",
|
||||
cm->msg_id);
|
||||
printf("ACK/RST for message with msg_id = %d received\n", cm->msg_id);
|
||||
s_time_to_exit = 1;
|
||||
break;
|
||||
}
|
||||
@ -63,7 +62,7 @@ int main(int argc, char* argv[]) {
|
||||
mg_set_protocol_coap(nc);
|
||||
|
||||
while (!s_time_to_exit) {
|
||||
mg_mgr_poll(&mgr, 1);
|
||||
mg_mgr_poll(&mgr, 1000000);
|
||||
}
|
||||
|
||||
mg_mgr_free(&mgr);
|
||||
|
@ -36,8 +36,7 @@ static void coap_handler(struct mg_connection *nc, int ev, void *p) {
|
||||
case MG_EV_COAP_ACK:
|
||||
case MG_EV_COAP_RST: {
|
||||
struct mg_coap_message *cm = (struct mg_coap_message *) p;
|
||||
printf("ACK/RST/NOC with msg_id = %d received\n",
|
||||
cm->msg_id);
|
||||
printf("ACK/RST/NOC with msg_id = %d received\n", cm->msg_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -63,7 +62,7 @@ int main() {
|
||||
mg_set_protocol_coap(nc);
|
||||
|
||||
while (!s_sig_received) {
|
||||
mg_mgr_poll(&mgr, 1);
|
||||
mg_mgr_poll(&mgr, 1000000);
|
||||
}
|
||||
|
||||
printf("Exiting on signal %d\n", s_sig_received);
|
||||
|
Loading…
x
Reference in New Issue
Block a user