From 1986820ec3670f5097617b9e5ac7194a35880d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20L=C3=B6ffel?= Date: Tue, 9 Oct 2018 13:29:19 +0200 Subject: [PATCH] added getHandshakeTimeout --- recws.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/recws.go b/recws.go index 5969feb..d033aa2 100644 --- a/recws.go +++ b/recws.go @@ -211,11 +211,19 @@ func (rc *RecConn) setDefaultHandshakeTimeout() { } func (rc *RecConn) setDefaultDialer() { + handshakeTimeout := rc.getHandshakeTimeout() rc.mu.Lock() defer rc.mu.Unlock() rc.dialer = websocket.DefaultDialer - rc.dialer.HandshakeTimeout = rc.HandshakeTimeout + rc.dialer.HandshakeTimeout = handshakeTimeout +} + +func (rc *RecConn) getHandshakeTimeout() time.Duration { + rc.mu.RLock() + defer rc.mu.RUnlock() + + return rc.HandshakeTimeout } // Dial creates a new client connection.