Robert de Bath's asynchronous-connect patch. Helps a lot in port
[u/mdw/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index 36db4e7..c03cd6d 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1686,6 +1686,11 @@ static char *connect_to_host(char *host, int port, char **realhost)
     /*
      * Try to find host.
      */
+    {
+       char buf[200];
+       sprintf(buf, "Looking up host \"%.170s\"", host);
+       logevent(buf);
+    }
     addr = sk_namelookup(host, realhost);
     if ((err = sk_addr_error(addr)))
        return err;
@@ -1697,6 +1702,12 @@ static char *connect_to_host(char *host, int port, char **realhost)
     /*
      * Open socket.
      */
+    {
+       char buf[200], addrbuf[100];
+       sk_getaddr(addr, addrbuf, 100);
+       sprintf(buf, "Connecting to %.100s port %d", addrbuf, port);
+       logevent(buf);
+    }
     s = sk_new(addr, port, 0, 1, &fn_table_ptr);
     if ((err = sk_socket_error(s)))
        return err;
@@ -2709,7 +2720,7 @@ static void ssh1_protocol(unsigned char *in, int inlen, int ispkt)
                int bufsize =
                    from_backend(pktin.type == SSH1_SMSG_STDERR_DATA,
                                 pktin.body + 4, len);
-               if (bufsize > SSH1_BUFFER_LIMIT) {
+               if (!ssh1_stdout_throttling && bufsize > SSH1_BUFFER_LIMIT) {
                    ssh1_stdout_throttling = 1;
                    ssh1_throttle(+1);
                }
@@ -2955,7 +2966,7 @@ static void ssh1_protocol(unsigned char *in, int inlen, int ispkt)
                        bufsize = 0;   /* agent channels never back up */
                        break;
                    }
-                   if (bufsize > SSH1_BUFFER_LIMIT) {
+                   if (!c->v.v1.throttling && bufsize > SSH1_BUFFER_LIMIT) {
                        c->v.v1.throttling = 1;
                        ssh1_throttle(+1);
                    }
@@ -5113,7 +5124,7 @@ void *new_sock_channel(Socket s)
 void ssh_unthrottle(int bufsize)
 {
     if (ssh_version == 1) {
-       if (bufsize < SSH1_BUFFER_LIMIT) {
+       if (ssh1_stdout_throttling && bufsize < SSH1_BUFFER_LIMIT) {
            ssh1_stdout_throttling = 0;
            ssh1_throttle(-1);
        }