delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/31/16:48:11

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <01a001c04384$8eaa1870$f7c723cb@lifelesswks>
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: "Dustin Lang" <dustinl AT interchange DOT ubc DOT ca>, <cygwin AT sources DOT redhat DOT com>
References: <Pine DOT LNX DOT 4 DOT 21 DOT 0010311226130 DOT 18952-100000 AT taz DOT cs DOT ubc DOT ca>
Subject: Re: Asynchronous DNS - gethostbyname_r
Date: Wed, 1 Nov 2000 08:50:15 +1100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.3018.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300
X-OriginalArrivalTime: 31 Oct 2000 21:43:29.0672 (UTC) FILETIME=[9B9A2080:01C04383]

Hi  Dustin,
    I'm not sure if this answers your question:
If you download the CVS head branch of squid 2.4 it has asynchronous calls
for cygwin already patched in the source. It also uses internal dns servers
so you don't get a dozen external process's.

Rob

----- Original Message -----
From: "Dustin Lang" <dustinl AT interchange DOT ubc DOT ca>
To: <cygwin AT sources DOT redhat DOT com>
Sent: Wednesday, November 01, 2000 7:52 AM
Subject: Asynchronous DNS - gethostbyname_r


>
> Hi,
>
> I'm working on a net application (a personal proxy server).  For a couple
> of reasons (masochism may be one...), I've decided to use non-blocking
> calls and select() rather than the standard accept()-fork() for handling
> requests.
>
> The main problem with this is DNS lookups, since the standard
> gethostbyname() has no notion of being non-blocking.  I've decided to get
> around this by creating a handful of pthreads to perform the lookups.  The
> single main network thread adds a lookup request item onto a list, and the
> "worker" lookup pthreads take a request off the list, perform the lookup,
> and store the result in a cache list.
>
> The problem with this is that the standard gethostbyname() call uses
> static storage to return the result, so is not safe to use in multiple
> pthreads.  There isn't really a way to work around this, so a new call has
> been created, gethostbyname_r, which accepts a buffer in which the result
> is placed.  (I'm not sure which standard (if any) specifies this call, but
> it exists in glibc and also in the Sun machines at my school, so it must
> be fairly widespread...).  Sadly, cygwin (and winsock) doesn't (seem
> to) have this call.
>
> I was going to write my own gethostbyname_r, but realized that cygwin's
> gethostbyname just calls winsock's (as I might have expected if I'd given
> it any thought...).
>
> There as a GNU asynch DNS library which I considered using, but it expects
> standard UNIX things like /etc/resolv.conf with DNS server IP addresses,
> and I'd like my app to work basically transparently, since I want it to be
> usable by dummies.
>
> I was thinking of trying to hack up similar functionality by using the
> WSAAsyncGetHostByName() call, which as you might expect does asynchronous
> DNS lookups.  However, when the lookup completes it delivers a windows
> message - hWnds and all those gnarly things.  I don't think I want to deal
> with the utter frustration that is dealing with the windows API - that's
> why I'm using cygwin in the first place!
>
> Basically the options I'm looking at now is doing DNS lookups a la SQUID
> (www.squid-cache.org): it forks about a dozen processes which exec an
> external dns lookup program; the main program communicates with the
> external program via pipes.  The external processes can block all they
> like.
>
> Any suggestions or comments are welcomed.
>
> Thanks!
> dstn.
>
>
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
>
>


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019