1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Actually print announcements of Interactors' identity.

Finally, the payoff from all of this refactoring: now, when a proxy
prompts interactively during connection setup, you get a message in
advance telling you which Interactor is originating the following
messages.

To achieve this, I've arranged to link Interactors together into a
list, so that any Interactor created by a proxy has a 'parent' pointer
pointing to the Interactor its client passed to new_connection().

This allows interactor_announce() to follow the links back up the
chain and count them, so that it knows whether it's a primary
connection, or a proxy, or a proxy-for-a-proxy, or more generally an
nth-order proxy, and can include that in its announcement.

And secondly, once interactor_announce() reaches the top of the chain,
it can use that as a storage location agreed on by all Interactors in
the whole setup, to tell each other which one of them was the last to
do anything interactive. Then, whenever there's a change of
Interactor, a message can be printed to indicate it to the user; and
when the same Interactor does multiple things in succession, you don't
get a slew of pointless messages in between them all.
This commit is contained in:
Simon Tatham
2021-10-30 18:08:02 +01:00
parent 7460594433
commit 215b9d1775
3 changed files with 69 additions and 11 deletions

15
putty.h
View File

@ -661,6 +661,19 @@ struct InteractionReadySeat {
*/
struct Interactor {
const InteractorVtable *vt;
/* The parent Interactor that we are a proxy for, if any. */
Interactor *parent;
/*
* If we're the top-level Interactor (parent==NULL), then this
* field records the last Interactor that actually did anything
* interactive, so that we know when to announce a changeover
* between levels of proxying.
*
* If parent != NULL, this field is not used.
*/
Interactor *last_to_talk;
};
struct InteractorVtable {
@ -706,6 +719,8 @@ static inline Seat *interactor_get_seat(Interactor *itr)
static inline void interactor_set_seat(Interactor *itr, Seat *seat)
{ itr->vt->set_seat(itr, seat); }
static inline void interactor_set_child(Interactor *parent, Interactor *child)
{ child->parent = parent; }
Seat *interactor_borrow_seat(Interactor *itr);
void interactor_return_seat(Interactor *itr);
InteractionReadySeat interactor_announce(Interactor *itr);