mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Set woken flag when flushing so that the channel is freed, while here
use the same loop construct for both loops.
This commit is contained in:
parent
a3de5dbab1
commit
ede0f2f633
@ -97,7 +97,6 @@ cmd_wait_for_add(const char *name)
|
|||||||
void
|
void
|
||||||
cmd_wait_for_remove(struct wait_channel *wc)
|
cmd_wait_for_remove(struct wait_channel *wc)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (wc->locked)
|
if (wc->locked)
|
||||||
return;
|
return;
|
||||||
if (!TAILQ_EMPTY(&wc->waiters) || !wc->woken)
|
if (!TAILQ_EMPTY(&wc->waiters) || !wc->woken)
|
||||||
@ -241,7 +240,8 @@ cmd_wait_for_flush(void)
|
|||||||
if (!cmdq_free(wq))
|
if (!cmdq_free(wq))
|
||||||
cmdq_continue(wq);
|
cmdq_continue(wq);
|
||||||
}
|
}
|
||||||
while ((wq = TAILQ_FIRST(&wc->lockers)) != NULL) {
|
wc->woken = 1;
|
||||||
|
TAILQ_FOREACH_SAFE(wq, &wc->lockers, waitentry, wq1) {
|
||||||
TAILQ_REMOVE(&wc->lockers, wq, waitentry);
|
TAILQ_REMOVE(&wc->lockers, wq, waitentry);
|
||||||
if (!cmdq_free(wq))
|
if (!cmdq_free(wq))
|
||||||
cmdq_continue(wq);
|
cmdq_continue(wq);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user