On Thu, 19 Mar 2009, Daniel Stenberg wrote:

> In general it is painful to support both the way the code works now. I 
> wonder if we can think of a better way...

Would it be completely crazy if we did all the internals of libssh2 to deal 
with non-blocking only, and "only" provide wrapper code that deals with the 
blockingness this way:

(pseudo code for how it'd work for blocking sockets)

  API-function ()
  {
    set_nonblocking()
    do {
      rc = useinternal_function()
      if (rc) {
        wait_for_socket_action();
      }
    } while (rc == EAGAIN);
    set_blocking()
    return rc;
  }

The upside will be that only these upper layer functions would need to bother 
about blockiness, and all the "core" functionality would always assume and use 
non-blocking.

We would also gain some control and be able to for example allow flexible 
time-outs etc even for the blocking API.

-- 

  / daniel.haxx.se

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to