Only add/remove poll events when they aren't already done.

pull/1698/head
Roger A. Light 5 years ago
parent fabdfcc060
commit 86e0122a2d

@ -110,6 +110,7 @@ int mux_poll__add_out(struct mosquitto *context)
{
int i;
if(!(context->events & POLLOUT)) {
if(context->pollfd_index != -1){
pollfds[context->pollfd_index].fd = context->sock;
pollfds[context->pollfd_index].events = POLLIN | POLLOUT;
@ -128,6 +129,8 @@ int mux_poll__add_out(struct mosquitto *context)
}
}
}
context->events = POLLIN | POLLOUT;
}
return MOSQ_ERR_SUCCESS;
}
@ -135,7 +138,11 @@ int mux_poll__add_out(struct mosquitto *context)
int mux_poll__remove_out(struct mosquitto *context)
{
if(context->events & POLLOUT) {
return mux_poll__add_in(context);
}else{
return MOSQ_ERR_SUCCESS;
}
}
@ -161,6 +168,7 @@ int mux_poll__add_in(struct mosquitto *context)
}
}
}
context->events = POLLIN;
return MOSQ_ERR_SUCCESS;
}

Loading…
Cancel
Save