code: func (i *AgentIPC) listen() {
  	for {
  		conn, err := i.listener.Accept()
  		if err != nil {
  			if i.stop {
  				return
  			}
  			i.logger.Printf("[ERR] agent.ipc: Failed to accept client: %v", err)
  			continue
  		}
  		i.logger.Printf("[INFO] agent.ipc: Accepted client: %v", conn.RemoteAddr())
  		metrics.IncrCounter([]string{"agent", "ipc", "accept"}, 1)
  
  		// Wrap the connection in a client
  		client := &IPCClient{
  			name:           conn.RemoteAddr().String(),
  			conn:           conn,
  			reader:         bufio.NewReader(conn),
  			writer:         bufio.NewWriter(conn),
  			eventStreams:   make(map[uint64]*eventStream),
  			pendingQueries: make(map[uint64]*serf.Query),
  		}
  		client.dec = codec.NewDecoder(client.reader,
  			&codec.MsgpackHandle{RawToString: true, WriteExt: true})
  		client.enc = codec.NewEncoder(client.writer,
  			&codec.MsgpackHandle{RawToString: true, WriteExt: true})
  
  		// Register the client
  		i.Lock()
  		if !i.stop {
  			i.clients[client.name] = client
  			go i.handleClient(client)
  		} else {
  			conn.Close()
  		}
  		i.Unlock()
  	}
  }
docs: // listen is a long running routine that listens for new clients