Skip to content

Commit

Permalink
last fix...
Browse files Browse the repository at this point in the history
  • Loading branch information
andyxning committed Dec 20, 2017
1 parent f3fe32e commit b3f71ec
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,9 @@ func (c *Conn) ConnectTTV2() (*IdentifyResponse, error) {
c.conn.SetReadDeadline(time.Now().Add(time.Second))
// TODO(andyxning): remove magic number
buf := make([]byte, 100)
count, err := c.conn.Read(buf)
_, err = c.conn.Read(buf)
if err == nil {
if strings.Contains(string(buf), "E_BAD_PROTOCOL") || string(buf[:count]) == "" {
return nil, ErrUnsupportedTTV2
}
c.log(LogLevelError, fmt.Sprintf("NSQD returns error: %v", string(buf)))
return nil, fmt.Errorf("NSQD returns error: %v", string(buf))
return nil, ErrUnsupportedTTV2
} else {
// TODO(andyxning): remove magic string
// because poll is an internal package and we can not reference poll.TimeoutError.
Expand Down

0 comments on commit b3f71ec

Please sign in to comment.