mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 20: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:
@ -66,6 +66,7 @@ typedef struct supdup_tag Supdup;
|
||||
struct supdup_tag
|
||||
{
|
||||
Socket *s;
|
||||
bool socket_connected;
|
||||
bool closed_on_socket_error;
|
||||
|
||||
Seat *seat;
|
||||
@ -561,7 +562,9 @@ static void supdup_log(Plug *plug, PlugLogType type, SockAddr *addr, int port,
|
||||
Supdup *supdup = container_of(plug, Supdup, plug);
|
||||
backend_socket_log(supdup->seat, supdup->logctx, type, addr, port,
|
||||
error_msg, error_code,
|
||||
supdup->conf, supdup->state != CONNECTING);
|
||||
supdup->conf, supdup->socket_connected);
|
||||
if (type == PLUGLOG_CONNECT_SUCCESS)
|
||||
supdup->socket_connected = true;
|
||||
}
|
||||
|
||||
static void supdup_closing(Plug *plug, const char *error_msg, int error_code,
|
||||
@ -662,6 +665,7 @@ static char *supdup_init(const BackendVtable *x, Seat *seat,
|
||||
supdup->logctx = logctx;
|
||||
supdup->conf = conf_copy(conf);
|
||||
supdup->s = NULL;
|
||||
supdup->socket_connected = false;
|
||||
supdup->closed_on_socket_error = false;
|
||||
supdup->seat = seat;
|
||||
supdup->term_width = conf_get_int(supdup->conf, CONF_width);
|
||||
@ -861,7 +865,8 @@ static bool supdup_connected(Backend *be)
|
||||
|
||||
static bool supdup_sendok(Backend *be)
|
||||
{
|
||||
return 1;
|
||||
Supdup *supdup = container_of(be, Supdup, backend);
|
||||
return supdup->socket_connected;
|
||||
}
|
||||
|
||||
static void supdup_unthrottle(Backend *be, size_t backlog)
|
||||
|
Reference in New Issue
Block a user