Measure RTT for network queries

This commit is contained in:
Tony Garnock-Jones 2012-01-25 17:56:57 -05:00
parent d1ad3d7086
commit c84ed33697
1 changed files with 4 additions and 0 deletions

View File

@ -172,6 +172,7 @@
s
(udp-address server-host-name server-port)))
(define subscription-id (list s (dns-message-id query)))
(define start-time (current-inexact-milliseconds))
(list (send-message req)
(send-message (set-timer subscription-id (* timeout 1000) #t))
(subscribe subscription-id
@ -183,6 +184,9 @@
(k 'no-answer))]
[(dns-reply reply-message source (== s))
;; TODO: maybe receive only specifically from the queried IP address?
(write `(,q --> ,(dns-message-answers reply-message) from ,server-ip in
,(inexact->exact (round (- (current-inexact-milliseconds) start-time)))
ms)) (newline)
(if (not (= (dns-message-id reply-message) (dns-message-id query)))
w
(transition w