check: stop current check process when timeout (#159)

This commit is contained in:
nadoo committed 2020-05-04 15:33:26 +08:00
1 parent 061b3da42e
commit 3392db41de
3 files changed
+14 -7

No files matched your search

+2
View File
@@ -252,6 +252,8 @@ func checkWebSite(fwdr *Forwarder, website string, timeout time.Duration, buf []
}
defer rc.Close()
rc.SetDeadline(time.Now().Add(timeout))
_, err = rc.Write([]byte("GET / HTTP/1.0\r\n\r\n"))
if err != nil {
fwdr.Disable()