code: func (m *Memberlist) readRemoteState(bufConn io.Reader, dec *codec.Decoder) (bool, []pushNodeState, []byte, error) {
  	// Read the push/pull header
  	var header pushPullHeader
  	if err := dec.Decode(&header); err != nil {
  		return false, nil, nil, err
  	}
  
  	// Allocate space for the transfer
  	remoteNodes := make([]pushNodeState, header.Nodes)
  
  	// Try to decode all the states
  	for i := 0; i < header.Nodes; i++ {
  		if err := dec.Decode(&remoteNodes[i]); err != nil {
  			return false, nil, nil, err
  		}
  	}
  
  	// Read the remote user state into a buffer
  	var userBuf []byte
  	if header.UserStateLen > 0 {
  		userBuf = make([]byte, header.UserStateLen)
  		bytes, err := io.ReadAtLeast(bufConn, userBuf, header.UserStateLen)
  		if err == nil && bytes != header.UserStateLen {
  			err = fmt.Errorf(
  				"Failed to read full user state (%d / %d)",
  				bytes, header.UserStateLen)
  		}
  		if err != nil {
  			return false, nil, nil, err
  		}
  	}
  
  	// For proto versions < 2, there is no port provided. Mask old
  	// behavior by using the configured port
  	for idx := range remoteNodes {
  		if m.ProtocolVersion() < 2 || remoteNodes[idx].Port == 0 {
  			remoteNodes[idx].Port = uint16(m.config.BindPort)
  		}
  	}
  
  	return header.Join, remoteNodes, userBuf, nil
  }
docs: // readRemoteState is used to read the remote state from a connection