#194: Scp Bug
-----------------------+----------------------------------------------------
Reporter: robocide | Owner:
Type: defect | Status: closed
Priority: high | Milestone: 1.2.7
Component: SCP | Version: 1.2.7
Resolution: invalid | Keywords:
Blocks: | Blocked By:
-----------------------+----------------------------------------------------
Comment (by stuge):
This ticket is about channels in the SSH protocol. Check the protocol RFCs
to learn more about those.
Replying to [comment:2 robocide]:
> 1] does this restriction applys to accuiring more than 10 sftp_handles
as well ?
libssh2_sftp_init() is the SFTP function that opens a channel, and
libssh2_sftp_open() uses that channel to ask the SFTP server running on
the remote end to open a file. So if you call _sftp_init() 11 times then
the 11th time will fail just like for scp. But _sftp_open() is for talking
to the SFTP server that was started by the SSH server for the channel, and
it does not open channels. Of course it is possible that the SFTP server
also has a limit for 10 open files, just like the SSH server has a limit
for 10 open channels, in your case.
> 2] why this restriction is not documented in the API reference ? i would
be happy to do it as well.
As was pointed out this is a server side configuration issue.
Your program must always check for errors that libssh2 can return, and
your program must always decide how to handle each error that can be
returned depending on the internal state of your program. If trying to
transfer many files in parallell then there is of course no reason to
disconnect from the server or exit the program just because channel or
file handle number 11 can not be opened, when there are already some open
ones.
To study this further for OpenSSH sshd you should look at the function
channel_new() in channels.c of the OpenSSH source code. More recent
versions of OpenSSH will dynamically allocate extra channels if a client
wants to open more than 10, so you could try to use the very latest
version of OpenSSH on the server if more than 10 open channels is a
requirement.
-- Ticket URL: <http://trac.libssh2.org/ticket/194#comment:8> libssh2 <http://trac.libssh2.org/> C library for writing portable SSH2 clients _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2010-11-01