code: func (nc *Conn) processOpErr(err error) {
  	nc.mu.Lock()
  	if nc.isConnecting() || nc.isClosed() || nc.isReconnecting() {
  		nc.mu.Unlock()
  		return
  	}
  
  	if nc.Opts.AllowReconnect && nc.status == CONNECTED {
  		// Set our new status
  		nc.status = RECONNECTING
  		// Stop ping timer if set
  		nc.stopPingTimer()
  		if nc.conn != nil {
  			nc.bw.Flush()
  			nc.conn.Close()
  			nc.conn = nil
  		}
  
  		// Create pending buffer before reconnecting.
  		nc.pending = new(bytes.Buffer)
  		nc.bw.Reset(nc.pending)
  
  		go nc.doReconnect()
  		nc.mu.Unlock()
  		return
  	}
  
  	nc.status = DISCONNECTED
  	nc.err = err
  	nc.mu.Unlock()
  	nc.Close()
  }
docs: // processOpErr handles errors from reading or parsing the protocol.
  // The lock should not be held entering this function.