likexian / whois

Whois client for domain and ip whois information query in Go(Golang).
Apache License 2.0
382 stars 70 forks source link

Make rawQuery timeout handling more thread-safe #42

Open ugexe opened 3 months ago

ugexe commented 3 months ago

Previously an elapsed duration was saved on the Client object and was updated multiple times on each call to rawQuery. This could lead to a race condition when calling whois.Whois(...) in parallel, where one thread halfway through the function has a non-zero elapsed duration and another thread entering the function sets it to 0. This removes the elapsed field on the Client object and uses a local variable instead, which avoids the aforementioned issue.