code: func (s *TrapServer) Serve(listener TrapListener) error {
  	if listener == nil {
  		return &ArgumentError{Message: "listener is nil"}
  	}
  	s.servingMu.Lock()
  	s.serving = true
  	s.servingMu.Unlock()
  	size := s.args.MessageMaxSize
  	if size < recvBufferSize {
  		size = recvBufferSize
  	}
  
  	for {
  		conn, err := s.transport.Listen()
  		s.servingMu.RLock()
  		serving := s.serving
  		s.servingMu.RUnlock()
  		if !serving {
  			return nil
  		}
  		if err != nil {
  			if e, ok := err.(net.Error); ok && e.Temporary() {
  				continue
  			}
  			return err
  		}
  
  		go func(conn interface{}) {
  			defer s.transport.Close(conn)
  			buf := make([]byte, size)
  			for {
  				_, src, msg, err := s.transport.Read(conn, buf)
  				if _, ok := err.(net.Error); ok {
  					s.servingMu.RLock()
  					serving := s.serving
  					s.servingMu.RUnlock()
  					if serving {
  						s.logf("trap: failed to read packet: %v", err)
  					}
  					return
  				}
  
  				go s.handle(listener, conn, msg, src, err)
  			}
  		}(conn)
  	}
  }
docs: // Serve starts the SNMP trap receiver.
  // Serve blocks, the caller should call Close when finished, to shut it down.