Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Some simple fixes #245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion zk/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func Connect(servers []string, sessionTimeout time.Duration, options ...connOpti
if strings.Contains(addr, ":") {
srvs[i] = addr
} else {
srvs[i] = addr + ":" + strconv.Itoa(DefaultPort)
srvs[i] = net.JoinHostPort(addr, strconv.Itoa(DefaultPort))
}
}

Expand Down Expand Up @@ -223,6 +223,7 @@ func Connect(servers []string, sessionTimeout time.Duration, options ...connOpti
conn.loop()
conn.flushRequests(ErrClosing)
conn.invalidateWatches(ErrClosing)
conn.flushUnsentRequests(ErrClosing)
close(conn.eventChan)
}()
return conn, ec, nil
Expand Down Expand Up @@ -488,6 +489,14 @@ func (c *Conn) loop() {
case err == ErrSessionExpired:
c.logger.Printf("Authentication failed: %s", err)
c.invalidateWatches(err)
for {
select {
case <-c.shouldQuit:
return
case req := <-c.sendChan:
req.recvChan <- response{-1, err}
}
}
case err != nil && c.conn != nil:
c.logger.Printf("Authentication failed: %s", err)
c.conn.Close()
Expand Down