code: func (r *router) matchAndDispatch(messages <-chan *packets.PublishPacket, order bool, client *client) {
  	go func() {
  		for {
  			select {
  			case message := <-messages:
  				sent := false
  				r.RLock()
  				m := messageFromPublish(message, client.ackFunc(message))
  				handlers := []MessageHandler{}
  				for e := r.routes.Front(); e != nil; e = e.Next() {
  					if e.Value.(*route).match(message.TopicName) {
  						if order {
  							handlers = append(handlers, e.Value.(*route).callback)
  						} else {
  							hd := e.Value.(*route).callback
  							go func() {
  								hd(client, m)
  								m.Ack()
  							}()
  						}
  						sent = true
  					}
  				}
  				if !sent && r.defaultHandler != nil {
  					if order {
  						handlers = append(handlers, r.defaultHandler)
  					} else {
  						go func() {
  							r.defaultHandler(client, m)
  							m.Ack()
  						}()
  					}
  				}
  				r.RUnlock()
  				for _, handler := range handlers {
  					func() {
  						handler(client, m)
  						m.Ack()
  					}()
  				}
  			case <-r.stop:
  				return
  			}
  		}
  	}()
  }
docs: // matchAndDispatch takes a channel of Message pointers as input and starts a go routine that
  // takes messages off the channel, matches them against the internal route list and calls the
  // associated callback (or the defaultHandler, if one exists and no other route matched). If
  // anything is sent down the stop channel the function will end.