mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Fix bug that caused crash in go 1.1
This commit is contained in:
@@ -73,9 +73,16 @@ func clientConnStr(conn net.Conn) interface{} {
|
||||
}
|
||||
|
||||
func (c *client) readLoop() {
|
||||
// Grab the connection off the client, it will be cleared on a close.
|
||||
// We check for that after the loop, but want to avoid a nil dereference
|
||||
conn := c.conn
|
||||
if conn == nil {
|
||||
return
|
||||
}
|
||||
b := make([]byte, defaultBufSize)
|
||||
|
||||
for {
|
||||
n, err := c.conn.Read(b)
|
||||
n, err := conn.Read(b)
|
||||
if err != nil {
|
||||
c.closeConnection()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user