wallix/pylibssh2 — pull request #8 by Morian (2012-05-13 19:43:32+00:00)
Title: pylibssh2 in non blocking mode

Hi !

I am creating an application using your python module pylibssh2 (1.0.2).
I tried to use it in non blocking mode, because I want to set a timer while reading channels.
I first tried to use the poll_read() method, but I keep getting '0' although there is data waiting to be read.

I got an issue in non blocking mode, because pylibssh2 throws exceptions whenever the return value got from libssh2 is negative. In non blocking mode, libssh2 functions return LIBSSH2_ERROR_EAGAIN (-37), which is then treated like errors by pylibssh2.

To work around this I made a small patch which prevents exceptions from being thrown when libssh2 returns LIBSSH2_ERROR_EAGAIN.
Instead the corresponding function in pylibssh2 returns LIBSSH2_ERROR_EAGAIN.
Seems to work fine for me this far,

Hope this can help in any kind of way, of course don't hesitate if you have questions.

Romain Bezut