Skip to content
Browse files

handle UDP responses asynchronously rather than waiting for a Netif r…

…esponse
  • Loading branch information...
1 parent 320265c commit b07730c3f3bca562b68209bfb253718fead53aed @avsm committed Apr 19, 2012
Showing with 4 additions and 3 deletions.
  1. +2 −2 lib/dns/server.ml
  2. +2 −1 lib/net/direct/udp.ml
View
4 lib/dns/server.ml
@@ -68,7 +68,7 @@ let no_memo mgr src dst bits =
let q = List.hd d.questions in
let r = get_answer q.q_name q.q_type d.id in
let p = marshal r in
- Net.Datagram.UDPv4.send mgr ~src dst p
+ let _ = Net.Datagram.UDPv4.send mgr ~src dst p in return ()
)
let leaky mgr src dst bits =
@@ -78,12 +78,12 @@ let leaky mgr src dst bits =
let q = List.hd d.questions in
let r = get_answer_memo q.q_name q.q_type d.id in
let p = marshal r in
-
Net.Datagram.UDPv4.send mgr ~src dst p
)
let listen ?(mode=`none) ~zonebuf mgr src =
Dnsserver.load_zone [] zonebuf;
+ Gc.compact ();
Net.Datagram.UDPv4.(recv mgr src
(match mode with
|`none -> no_memo mgr src
View
3 lib/net/direct/udp.ml
@@ -29,7 +29,8 @@ let input t ~src ~dst pkt =
checksum:16; data:(length-8)*8:bitstring } ->
if Hashtbl.mem t.listeners dest_port then begin
let fn = Hashtbl.find t.listeners dest_port in
- fn ~src ~dst ~source_port data
+ let _ = fn ~src ~dst ~source_port data in
+ return ()
end else
return ()

0 comments on commit b07730c

Please sign in to comment.
Something went wrong with that request. Please try again.