Subject: how NS handles mutiple queries

From: SRINIVASU V V S <[email-masked]>
Date: Fri, 4 Feb 2000 10:50:19 +0530

hi all,
  How a typical recursive name server handles mutiple queries. i think it 
has forked only once for its task..
  my questions are :
 1) A name server should send a query to some other name server for one of 
the request and wait for some time for its retransmission. Meanwhile if 
some other query times out it has to handle that also..how it diverts it's 
attention..

 2) The above situation becomes more complicated when some of the 
connections are TCP and some are UDP..

may be i am a bit confused.. plz suggest any docs for more info..

thanks in advance

srini

to unsubscribe send a message to [email-masked] with
the word 'unsubscribe' in a single line as the message text body.

---

From: Ted Lemon <[email-masked]>
Date: Fri, 04 Feb 2000 11:06:15 -0500

> some other query times out it has to handle that also..how it diverts it's 

The solution to this problem is to process requests (incoming and
outgoing) and maintain state on pending requests, rather than simply
handling one request to completion and ignoring other requests that
come in while the first request is pending with some other server.
You might consider reading over the source code to BIND 8 to see how
it does it!  :')

			       _MelloN_

---

From: James Seng <[email-masked]>
Date: Mon, 07 Feb 2000 19:20:21 +0800

BIND 4 or 8 does not fork. Nor does it do multi-treading. It is a single
process and maintain a queue for each recursive query (and remove them when it
recieves a response).

The relevant algo can be described as:

If Incoming is Query Packet Then
   // ns_req Query Packet 
   If in cache or authorizative for Query Then
       Response with appropriate answer
   Else If Recursive Query And Server able to do Recursion Then
       If ID already exist in Queue Then
           // Well, be patient. I am still waiting from the recursion
       Else
           Put Query ID and IP onto Queue
           Recurse the query
       EndIf
   Else
       Response Error
   EndIf  
Else
   // ns_resp Response Packet (received from recursive query)
   If ID match one in queue Then
       Response with answer from recursion
       Remove ID from Queue
   Else
       Response Error
   EndIf
EndIf

Of course, in between there are other stuff like cache etc.

-James Seng