Skip to content

Commit

Permalink
Don't update lastZxid on ping
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel committed Dec 13, 2012
1 parent 66a4f3f commit 14e9108
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,6 @@ func (c *Conn) recvLoop(conn net.Conn) error {

// log.Printf("Response xid=%d zxid=%d err=%d\n", res.Xid, res.Zxid, res.Err)

if res.Zxid > 0 {
c.lastZxid = res.Zxid
}

if res.Xid == -1 {
res := &watcherEvent{}
_, err := decodePacket(buf[16:16+blen], res)
Expand All @@ -329,7 +325,13 @@ func (c *Conn) recvLoop(conn net.Conn) error {
}
} else if res.Xid == -2 {
// Ping response. Ignore.
} else if res.Xid < 0 {
log.Printf("Xid < 0 (%d) but not ping or watcher event", res.Xid)
} else {
if res.Zxid > 0 {
c.lastZxid = res.Zxid
}

c.requestsLock.Lock()
req, ok := c.requests[res.Xid]
if ok {
Expand Down

0 comments on commit 14e9108

Please sign in to comment.