XXX-REMOVE-BEFORE-RELEASE: check docs too
[u/mdw/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index 8ecd060..b0cfa11 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -2444,6 +2444,7 @@ static int ssh_do_close(Ssh ssh, int notify_exit)
     struct ssh_channel *c;
 
     ssh->state = SSH_STATE_CLOSED;
+    expire_timer_context(ssh);
     if (ssh->s) {
         sk_close(ssh->s);
         ssh->s = NULL;
@@ -7571,6 +7572,9 @@ static void ssh2_timer(void *ctx, long now)
 {
     Ssh ssh = (Ssh)ctx;
 
+    if (ssh->state == SSH_STATE_CLOSED)
+       return;
+
     if (!ssh->kex_in_progress && ssh->cfg.ssh_rekey_time != 0 &&
        now - ssh->next_rekey >= 0) {
        do_ssh2_transport(ssh, "timeout", -1, NULL);