Subject: Re: RE : About simple examples

Re: RE : About simple examples

From: Peter Stuge <peter_at_stuge.se>
Date: Wed, 1 Apr 2009 19:21:26 +0200

Jean-Louis CHARTON wrote:
> rc = libssh2_session_startup(session, sock);
> if (rc) {
> error ...
> }
..
> but since we are in non blocking mode, I believe the code should be:
>
> do {
> rc = libssh2_session_startup(session, sock);
> } while (rc == LIBSSH2_ERROR_EAGAIN);
>
> if (rc) {
> error ...
> }

I disagree. I would treat the simple examples as just that - very
simple examples of how to call the library.

Different apps will likely want to handle different return codes in
different ways - especially when using nonblocking.

Rather than busywaiting on EAGAIN I think it would be better to set
the socket blocking before that call, and then set it nonblocking
again upon return - for the applications that want to use
nonblocking.

//Peter

------------------------------------------------------------------------------
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2009-04-01