From 2032d8c0f0abcb11c0bd4aa1285d57e7153fdb49 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 16 Aug 2017 10:38:45 -0600 Subject: tls-getcerts: timeout TCP R/W after 5 sec. --- tls-getcerts.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tls-getcerts.go b/tls-getcerts.go index 71fb8f4..34e25e5 100644 --- a/tls-getcerts.go +++ b/tls-getcerts.go @@ -12,6 +12,7 @@ import ( "net/url" "os" "strings" + "time" ) type xmppStreamsFeatures struct { @@ -118,6 +119,10 @@ func getcert(socket string) (*x509.Certificate, error) { if err != nil { return nil, err } + err = connRaw.SetDeadline(time.Now().Add(5 * time.Second)) + if err != nil { + return nil, err + } switch u.Path { case "", "/": -- cgit v1.2.3-54-g00ecf