cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libssh2 patch 10/17

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 18 Oct 2006 11:41:30 +0200 (CEST)

On Tue, 17 Oct 2006, James Housley wrote:

> I noticed that both ftp and tftp are driven by state machines. I will
> probably have to do the same for sftp. Do you have any tips before I start
> that?

Yes: don't base it on anything in the TFTP file since TFTP isn't implemented
"right" within libcurl.

Here's the full story:

We offer a multi interface to libcurl, which is non-blocking and thus all
protocol implementations should only do as much as they can without ever
blocking. Instead of blocking, they should return back to the caller. To get
this to work, you need to save the state and be able to continue exactly where
you were when you later get called again.

The TFTP code does not offer this, and thus it isn't the best member of the
libcurl family.

The FTP code was rewritten not so long ago to become this good member and it
tries hard never to block anything.

Now, libssh2 in itself doesn't really work non-blocking (that is, it works
fine with the socket set to non-blocking but the reads and writes will still
block to read and write full SSH-protocol packages), but IMO we should still
proceed and implement the SSH support as if it would support it. That way, the
day when it starts to support it we can adapt very easily. And we also may
very well support other SSH libs in the future and they just might work
non-blocking.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-10-18