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

Non-SSH network backends: handle PLUGLOG_CONNECT_SUCCESS.

All four of the other network-protocol backends (Raw, Telnet, rlogin
and SUPDUP) now have a 'socket_connected' flag, which starts off false
and is set to true when (if) their Socket signals that the connection
attempt has succeeded.

This field is used to tell backend_socket_log whether the session has
started yet (hence, whether it should still be logging messages from
the proxy). This replaces various ad-hoc answers to that question in
each backend, which were the best I could do when sockets didn't
notify connection success. Now they do, we can do it properly.

Also, the new flag controls the answer to each backend's sendok()
method, which makes them all satisfy a new policy rule: no backend
shall return true from sendok() while its network connection attempt
is still ongoing.

(Rationale: the network connection attempt may in future involve a
proxy implementation interacting with the user via the terminal, and
it can't do that if the backend is already consuming all the terminal
input.)
This commit is contained in:
Simon Tatham
2021-09-13 12:00:01 +01:00
parent 6b1154cc5b
commit 0b099b6a6f
5 changed files with 37 additions and 20 deletions

View File

@ -648,7 +648,14 @@ struct BackendVtable {
int (*exitcode) (Backend *be);
/* If back->sendok() returns false, the backend doesn't currently
* want input data, so the frontend should avoid acquiring any if
* possible (passing back-pressure on to its sender). */
* possible (passing back-pressure on to its sender).
*
* Policy rule: no backend shall return true from sendok() while
* its network connection attempt is still ongoing. This ensures
* that if making the network connection involves a proxy type
* which wants to interact with the user via the terminal, the
* proxy implementation and the backend itself won't fight over
* who gets the terminal input. */
bool (*sendok) (Backend *be);
bool (*ldisc_option_state) (Backend *be, int);
void (*provide_ldisc) (Backend *be, Ldisc *ldisc);