cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: further schannel improvements

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 14 Jun 2012 10:01:56 +0200 (CEST)

On Wed, 13 Jun 2012, Salisbury, Mark wrote:

> Back in April I announced I had some experience creating a schannel
> implementation for libcurl and I would like to help contribute to the effort
> that Marc had started. Marc took a first review of these patches yesterday,
> I've rebased them on top of the more recent changes and I think they are
> ready to go.
>
> I'd appreciate any feedback or questions anyone has on my patches.

The biggest nits I spotted are the loops you introduce in 0004 and 0005.

First, since you loop on EAGAIN it will make the code busy-loop like crazy
during periods and waste a lot of CPU. Any loop on EAGAIN *must* wait for
the proper socket activity until it retries the operation.

These loops however point to a larger problem. libcurl is designed to always
and ever use non-blocking sockets internally and we avoid all sorts of
blocking as much as possible. The code should rather be made to read as much
as possible and if it isn't enough data to proceed at any particular point in
time, it needs to keep that state and continue when there is more to read at
next opportunity. That's how basically all existing SSL libraries already
work. It will become especially notable when the multi interface is used.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-14