cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re[4]: Working with curl connections as with sockets.

From: tetetest tetetest <tetetest_at_rambler.ru>
Date: Tue, 06 May 2008 11:55:09 +0400

* Daniel Stenberg <daniel_at_haxx.se> [Tue, 6 May 2008 00:05:40 +0200
(CEST)]:
> On Mon, 5 May 2008, tetetest tetetest wrote:
>
> > I have checked the usage of Curl_write(), and have come to
conclusion
> > that if we modify it "to do right", the existing code will break.
> > Currently, libcurl does not handle EAGAIN at all - it simply retries
> > to send the data until it all goes out or a failure occurs. By the
way,
> > this means that on slow lines, libcurl can take up lots of CPU time
> > continuously calling send() in a cycle (am I right? Or did I miss
some
> > waits on the socket?).
>
> Where do you see this happening?

For example, in telnet.c (lines 1295-1303):

        while(nread--) {
          outbuf[0] = *buffer++;
          out_count = 1;
          if(outbuf[0] == CURL_IAC)
            outbuf[out_count++] = CURL_IAC;

          Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf,
                     out_count, &bytes_written);
        }

There are also similar places in the file below this point.

In general, I think this is because telnet support is less elaborate in
libcurl. I have checked other places in code that looked frightening
(e.g., in ftp.c), but they are correct (at least they look so for me).

> Ah nice, bonus points for the sample code!

Thanks. :)

--
tetetest tetetest.
Received on 2008-05-06