Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-06-15 03:45:40 -05:00
commit 52f5701f6c
2 changed files with 23 additions and 13 deletions

View File

@ -1,8 +1,8 @@
USING: kernel combinators sequences sets math USING: kernel combinators sequences sets math threads
io.sockets unicode.case accessors io.sockets unicode.case accessors
combinators.cleave combinators.lib combinators.cleave combinators.lib
newfx newfx fry
dns dns.util dns.misc ; dns dns.util dns.misc ;
IN: dns.server IN: dns.server
@ -50,9 +50,10 @@ IN: dns.server
: rr->rdata-names ( rr -- names/f ) : rr->rdata-names ( rr -- names/f )
{ {
{ [ dup type>> NS = ] [ rdata>> {1} ] } { [ dup type>> NS = ] [ rdata>> {1} ] }
{ [ dup type>> MX = ] [ rdata>> exchange>> {1} ] } { [ dup type>> MX = ] [ rdata>> exchange>> {1} ] }
{ [ t ] [ drop f ] } { [ dup type>> CNAME = ] [ rdata>> {1} ] }
{ [ t ] [ drop f ] }
} }
cond ; cond ;
@ -203,15 +204,18 @@ DEFER: query->rrs
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: loop ( -- ) : (handle-request) ( byte-array addr-spec -- )
socket receive >r
swap
parse-message parse-message
find-answer find-answer
message->ba message->ba
swap r>
socket send socket send ;
loop ;
: handle-request ( byte-array addr-spec -- )
'[ , , (handle-request) ] in-thread ;
: loop ( -- ) socket receive handle-request loop ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View File

@ -1,11 +1,12 @@
USING: kernel sequences assocs qualified circular ; USING: kernel sequences assocs qualified circular sets ;
USING: math multi-methods ; USING: math multi-methods ;
QUALIFIED: sequences QUALIFIED: sequences
QUALIFIED: assocs QUALIFIED: assocs
QUALIFIED: circular QUALIFIED: circular
QUALIFIED: sets
IN: newfx IN: newfx
@ -189,4 +190,9 @@ METHOD: as-mutate { object object assoc } set-at ;
! A note about the 'mutate' qualifier. Other words also technically mutate ! A note about the 'mutate' qualifier. Other words also technically mutate
! their primary object. However, the 'mutate' qualifier is supposed to ! their primary object. However, the 'mutate' qualifier is supposed to
! indicate that this is the main objective of the word, as a side effect. ! indicate that this is the main objective of the word, as a side effect.
: adjoin ( seq elt -- seq ) over sets:adjoin ;
: adjoin-on ( elt seq -- seq ) tuck sets:adjoin ;
: adjoined ( set elt -- ) swap sets:adjoin ;
: adjoined-on ( elt set -- ) sets:adjoin ;