code: func (p *Peer) QueueMessageWithEncoding(msg wire.Message, doneChan chan<- struct{},
  	encoding wire.MessageEncoding) {
  
  	// Avoid risk of deadlock if goroutine already exited.  The goroutine
  	// we will be sending to hangs around until it knows for a fact that
  	// it is marked as disconnected and *then* it drains the channels.
  	if !p.Connected() {
  		if doneChan != nil {
  			go func() {
  				doneChan <- struct{}{}
  			}()
  		}
  		return
  	}
  	p.outputQueue <- outMsg{msg: msg, encoding: encoding, doneChan: doneChan}
  }
docs: // QueueMessageWithEncoding adds the passed bitcoin message to the peer send
  // queue. This function is identical to QueueMessage, however it allows the
  // caller to specify the wire encoding type that should be used when
  // encoding/decoding blocks and transactions.
  //
  // This function is safe for concurrent access.