code: func (c *RPCClient) genericRPC(header *requestHeader, req interface{}, resp interface{}) error {
  	// Setup a response handler
  	errCh := make(chan error, 1)
  	handler := func(respHeader *responseHeader) {
  		// If we get an auth error, we should not wait for a request body
  		if respHeader.Error == authRequired {
  			goto SEND_ERR
  		}
  		if resp != nil {
  			err := c.dec.Decode(resp)
  			if err != nil {
  				errCh <- err
  				return
  			}
  		}
  	SEND_ERR:
  		errCh <- strToError(respHeader.Error)
  	}
  	c.handleSeq(header.Seq, &seqCallback{handler: handler})
  	defer c.deregisterHandler(header.Seq)
  
  	// Send the request
  	if err := c.send(header, req); err != nil {
  		return err
  	}
  
  	// Wait for a response
  	select {
  	case err := <-errCh:
  		return err
  	case <-c.shutdownCh:
  		return clientClosed
  	}
  }
docs: // genericRPC is used to send a request and wait for an
  // errorSequenceResponse, potentially returning an error