Subject: Re: [libssh2] libssh2-0.16 hanging on scp copy

Re: [libssh2] libssh2-0.16 hanging on scp copy

From: Eberhard Mattes <em-libssh2_at_online.ms>
Date: Mon, 13 Aug 2007 00:40:41 +0200

Daniel Stenberg wrote:

> Ok friends, I'll need some help and eyes on this.
>
> As I mentioned above, the check is bad and the patch below[1] is what I think
> will rectify this. Do note that this is almost a revertion of the
> src/transport.c 1.6 commit by me: "Eberhard Mattes' fix for
> libssh2_packet_read() for when reading very small chunks at a time.".

If you change that code please don't forget to test with small packets.
Here's a patch for openssh-4.5p1 which makes the server send small
packets. Without the patch mentioned above, libssh2 hangs, with that
patch, it works when transferring a file to the modified sftp server.

Eberhard

--- packet.c~ 2006-09-22 11:22:18.000000000 +0200
+++ packet.c 2007-05-08 11:46:17.000000000 +0200
@@ -1422,6 +1422,8 @@
          int len = buffer_len(&output);

          if (len > 0) {
+ if (len > 3)
+ len = 3;
                  len = write(connection_out, buffer_ptr(&output), len);
                  if (len <= 0) {
                          if (errno == EAGAIN)
@@ -1429,6 +1431,11 @@
                          else
                                  fatal("Write failed: %.100s", strerror(errno));
                  }
+ struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = 10 * 1000 * 1000;
+ nanosleep (&ts, NULL);
+
                  buffer_consume(&output, len);
          }
  }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-08-13