mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-02-03 21:52:24 +00:00
Remove unnecessary interactor_announce() calls.
In interactor_return_seat, I wrote a comment saying that we should call interactor_announce when handing over to the next Interactor in the chain, *if* any Interactor had already made any kind of announcement. But, having written that comment, I didn't actually *implement* the 'if' clause, and called interactor_announce unconditionally! Now fixed.
This commit is contained in:
parent
1811f51b94
commit
1fd27e649a
@ -21,6 +21,26 @@ Seat *interactor_borrow_seat(Interactor *itr)
|
|||||||
return clientseat;
|
return clientseat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Interactor *interactor_toplevel(Interactor *itr, unsigned *level_out)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Find the Interactor at the top of the chain, so that all the
|
||||||
|
* Interactors in a stack can share that one's last-to-talk field.
|
||||||
|
* Also, count how far we had to go to get to it, to put in the
|
||||||
|
* message.
|
||||||
|
*/
|
||||||
|
Interactor *itr_top = itr;
|
||||||
|
unsigned level = 0;
|
||||||
|
while (itr_top->parent) {
|
||||||
|
itr_top = itr_top->parent;
|
||||||
|
level++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (level_out)
|
||||||
|
*level_out = level;
|
||||||
|
return itr_top;
|
||||||
|
}
|
||||||
|
|
||||||
void interactor_return_seat(Interactor *itr)
|
void interactor_return_seat(Interactor *itr)
|
||||||
{
|
{
|
||||||
Seat *tempseat = interactor_get_seat(itr);
|
Seat *tempseat = interactor_get_seat(itr);
|
||||||
@ -37,7 +57,9 @@ void interactor_return_seat(Interactor *itr)
|
|||||||
* interactor_announce, then all Interactors from now on will
|
* interactor_announce, then all Interactors from now on will
|
||||||
* announce themselves even if they have nothing to say.
|
* announce themselves even if they have nothing to say.
|
||||||
*/
|
*/
|
||||||
interactor_announce(itr);
|
Interactor *itr_top = interactor_toplevel(itr, NULL);
|
||||||
|
if (itr_top->last_to_talk)
|
||||||
|
interactor_announce(itr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We're about to hand this seat back to the parent Interactor to
|
* We're about to hand this seat back to the parent Interactor to
|
||||||
@ -57,18 +79,8 @@ InteractionReadySeat interactor_announce(Interactor *itr)
|
|||||||
InteractionReadySeat iseat;
|
InteractionReadySeat iseat;
|
||||||
iseat.seat = seat;
|
iseat.seat = seat;
|
||||||
|
|
||||||
/*
|
unsigned level;
|
||||||
* Find the Interactor at the top of the chain, so that all the
|
Interactor *itr_top = interactor_toplevel(itr, &level);
|
||||||
* Interactors in a stack can share that one's last-to-talk field.
|
|
||||||
* Also, count how far we had to go to get to it, to put in the
|
|
||||||
* message.
|
|
||||||
*/
|
|
||||||
Interactor *itr_top = itr;
|
|
||||||
unsigned level = 0;
|
|
||||||
while (itr_top->parent) {
|
|
||||||
itr_top = itr_top->parent;
|
|
||||||
level++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generally, we should announce ourself if the previous
|
* Generally, we should announce ourself if the previous
|
||||||
|
Loading…
Reference in New Issue
Block a user