Hello libssh developers, I have found a code in channels.c, function
static ssh_channel ssh_channel_accept(ssh_session session, int channeltype, int timeout_ms) : for (t = timeout_ms; t >= 0; t -= 50) { ................... #ifdef _WIN32 Sleep(50); /* 50ms */ #else nanosleep(&ts, NULL); #endif } it make this function to sleep 50ms even if timeout_ms is 0. f.e, I want to develop application which open reverse tunnel: loop { ssh_channel newChan=channel_forward_accept(my_ssh_session,0); if(newChan) { newSocket= connect to server } ssh_select( ...... ) } In this case I calling function "channel_forward_accept" with timeout=0. I don't want this function to block execution of my thread. As result if I starting scp process over this tunnel, it is many times slower as scp over tunnel opened with "ssh -R". I attached a tiny patch, that make ssh_channel_accept not to wait 50 ms if timeout_ms is 0. Can you please accept it? With this patch my reverse tunnel created with libssh is as fast as tunnel created with "ssh -R". regards, alex -- Oleksandr Shneyder Dipl. Informatik X2go Core Developer Team email: oleksandr.shney...@obviously-nice.de web: www.obviously-nice.de --> X2go - everywh...@home
--- channels.c.orig 2010-11-18 11:57:56.457625033 +0100 +++ channels.c 2010-11-18 11:52:22.433612780 +0100 @@ -1657,11 +1657,13 @@ iterator = iterator->next; } } + if(t>0){ #ifdef _WIN32 Sleep(50); /* 50ms */ #else nanosleep(&ts, NULL); #endif + } } return NULL;
signature.asc
Description: OpenPGP digital signature