mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
poll: Use is_locked helper where possible
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -427,7 +427,7 @@ void ssh_poll_set_events(ssh_poll_handle p, short events)
|
||||
{
|
||||
p->events = events;
|
||||
if (p->ctx != NULL) {
|
||||
if (p->lock_cnt == 0) {
|
||||
if (!ssh_poll_is_locked(p)) {
|
||||
p->ctx->pollfds[p->x.idx].events = events;
|
||||
} else if (!(p->ctx->pollfds[p->x.idx].events & POLLOUT)) {
|
||||
/* if locked, allow only setting POLLOUT to prevent recursive
|
||||
@@ -730,7 +730,7 @@ int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout)
|
||||
* output buffer */
|
||||
for (i = 0; i < ctx->polls_used; i++) {
|
||||
/* The lock allows only POLLOUT events: drop the rest */
|
||||
if (ctx->pollptrs[i]->lock_cnt > 0) {
|
||||
if (ssh_poll_is_locked(ctx->pollptrs[i])) {
|
||||
ctx->pollfds[i].events &= POLLOUT;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user