2
0

added hasSubscribeHandler

This commit is contained in:
Lucas Löffel
2018-10-09 15:01:06 +02:00
parent f463fb2497
commit 14925171de
+8 -1
View File
@@ -280,6 +280,13 @@ func (rc *RecConn) getBackoff() *backoff.Backoff {
}
}
func (rc *RecConn) hasSubscribeHandler() bool {
rc.mu.RLock()
defer rc.mu.RUnlock()
return rc.SubscribeHandler != nil
}
func (rc *RecConn) connect() {
b := rc.getBackoff()
@@ -302,7 +309,7 @@ func (rc *RecConn) connect() {
if !rc.getNonVerbose() {
log.Printf("Dial: connection was successfully established with %s\n", rc.url)
if rc.SubscribeHandler == nil {
if !rc.hasSubscribeHandler() {
return
}