ref: 0583aac30855373b6829a5dd28e21352c690a33d
parent: c34379a283e1817c168060d5bd8eaaf06438486a
author: Ori Bernstein <ori@eigenstate.org>
date: Thu May 5 19:38:24 EDT 2016
Only allow one inflight DNS request. We only support threads a little bit.
--- a/lib/std/resolve+posixy.myr
+++ b/lib/std/resolve+posixy.myr
@@ -230,14 +230,17 @@
if !valid(host)
-> `Fail (`Badhost)
;;
+ lock(netlck)
for ns in nameservers
nsrv = dnsconnect(ns)
if nsrv >= 0
r = dnsquery(nsrv, host, rt)
sys.close(nsrv)
+ unlock(netlck)
-> r
;;
;;
+ unlock(netlck)
-> `Fail (`Badsrv)
}