cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] Call progress function when poll()/select() is interrupted

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 14 Apr 2008 15:48:30 +0200 (CEST)

On Sat, 12 Apr 2008, Pierre Ynard wrote:

> This patch makes the progress update function get called when
> poll()/select() in select.c are interrupted by a signal. As discussed in the
> previous thread (http://curl.haxx.se/mail/lib-2008-03/0011.html), the
> purpose is to allow applications using libcurl to cleanly abort operations
> upon receiving a signal in the middle of performing a request with libcurl.

Thanks!

I'm in favor of doing this, but I have a minor issue with it that I think we
should fix:

The use of "magic numbers" are increased a lot. And by magic numbers I mean
that the existing (before this patch) uses explit checks for -1 and 0 on
multiple places and that is already a bit on the bad side - as using named
defines would much more readable by somewhat removing the need to lookup what
the number actually means. Adding -2 to the pile thus makes the code even
worse in that aspect.

Do you think you could add some defines for these magic return codes and make
the code use them instead?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-04-14