// removeSelfLoop deletes from the list of peers peer which has sent the message
761359
func (g *gossipServiceImpl) removeSelfLoop(msg *emittedGossipMessage, peers []*comm.RemotePeer) []*comm.RemotePeer {
	var result []*comm.RemotePeer
	for _, peer := range peers {
		if msg.filter(peer.PKIID) {
			result = append(result, peer)
		}
	}
	return result
}
1213214
func (c *Cluster) RemoveNode(input string, force bool) error {
	return c.lockedManagerAction(func(ctx context.Context, state nodeState) error {
		node, err := getNode(ctx, state.controlClient, input)
		if err != nil {
			return err
		}

		_, err = state.controlClient.RemoveNode(ctx, &swarmapi.RemoveNodeRequest{NodeID: node.ID, Force: force})
		return err
	})
}
127495
func (s *Sublist) removeFromNode(n *node, element interface{}) (found bool) {
	if n == nil {
		return false
	}
	n.elements, found = removeFromList(element, n.elements)
	return found
}
31956
func (d *OvsDriver) DeletePeerHost(node core.ServiceInfo) error {
	// Nothing to do if this is our own IP
	if node.HostAddr == d.localIP {
		return nil
	}

	log.Infof("DeletePeerHost for %+v", node)

	// Remove the VTEP for the peer in vxlan switch.
	err := d.switchDb["vxlan"].DeleteVtep(node.HostAddr)
	if err != nil {
		log.Errorf("Error deleting the VTEP %s. Err: %s", node.HostAddr, err)
		return err
	}

	return nil
}
864637
func (bcR *BlockchainReactor) RemovePeer(peer p2p.Peer, reason interface{}) {
	bcR.pool.RemovePeer(peer.ID())
}
285298
func (nt *NodeTree) RemoveNode(n *v1.Node) error {
	nt.mu.Lock()
	defer nt.mu.Unlock()
	return nt.removeNode(n)
}
799353
func (m *Mercury) DeleteNode(ctx context.Context, node *types.Node) {
	if node == nil {
		return
	}
	m.doDeleteNode(ctx, node.Podname, node.Name, node.Endpoint)
}
947117
func (rt *RoutingTable) Remove(p peer.ID) {
	rt.tabLock.Lock()
	defer rt.tabLock.Unlock()
	peerID := ConvertPeerID(p)
	cpl := CommonPrefixLen(peerID, rt.local)

	bucketID := cpl
	if bucketID >= len(rt.Buckets) {
		bucketID = len(rt.Buckets) - 1
	}

	bucket := rt.Buckets[bucketID]
	if bucket.Remove(p) {
		rt.PeerRemoved(p)
	}
}
91272
func (r *PEXReactor) RemovePeer(p Peer, reason interface{}) {
	id := string(p.ID())
	r.requestsSent.Delete(id)
	r.lastReceivedRequests.Delete(id)
}
1034389
func (mm *MessageManager) clearRemovedHandlers() {
	for messageType, handlerList := range mm.handlersToRemove {
		for _, handlerID := range handlerList {
			mm.removeHandler(messageType, handlerID)
		}
	}
	mm.handlersToRemove = make(map[string][]MessageHandlerId)
}
370645
func (s *Single) RemoveNode(v quad.Value) error {
	gv := s.qs.ValueOf(v)
	if gv == nil {
		return graph.ErrNodeNotExists
	}
	del := graph.NewRemover(s)
	defer del.Close()

	total := 0
	// TODO(dennwc): QuadStore may remove node without iterations. Consider optional interface for this.
	for _, d := range []quad.Direction{quad.Subject, quad.Predicate, quad.Object, quad.Label} {
		r := graph.NewResultReader(s.qs, s.qs.QuadIterator(d, gv))
		n, err := quad.Copy(del, r)
		r.Close()
		if err != nil {
			return err
		}
		total += n
	}
	if err := del.Flush(); err != nil {
		return err
	}
	if total == 0 {
		return graph.ErrNodeNotExists
	}
	return nil
}
242872
func (s *Sublist) removeFromNode(n *node, sub *subscription) (found bool) {
	if n == nil {
		return false
	}
	if sub.queue == nil {
		_, found = n.psubs[sub]
		delete(n.psubs, sub)
		if found && n.plist != nil {
			// This will brute force remove the plist to perform
			// correct behavior. Will get re-populated on a call
			// to Match as needed.
			n.plist = nil
		}
		return found
	}

	// We have a queue group subscription here
	qsub := n.qsubs[string(sub.queue)]
	_, found = qsub[sub]
	delete(qsub, sub)
	if len(qsub) == 0 {
		delete(n.qsubs, string(sub.queue))
	}
	return found
}
1180543
func (s *server) RemovePeer(name string) error {
	s.debugln("server.peer.remove: ", name, len(s.peers))

	// Skip the Peer if it has the same name as the Server
	if name != s.Name() {
		// Return error if peer doesn't exist.
		peer := s.peers[name]
		if peer == nil {
			return fmt.Errorf("raft: Peer not found: %s", name)
		}

		// Stop peer and remove it.
		if s.State() == Leader {
			// We create a go routine here to avoid potential deadlock.
			// We are holding log write lock when reach this line of code.
			// Peer.stopHeartbeat can be blocked without go routine, if the
			// target go routine (which we want to stop) is calling
			// log.getEntriesAfter and waiting for log read lock.
			// So we might be holding log lock and waiting for log lock,
			// which lead to a deadlock.
			// TODO(xiangli) refactor log lock
			s.routineGroup.Add(1)
			go func() {
				defer s.routineGroup.Done()
				peer.stopHeartbeat(true)
			}()
		}

		delete(s.peers, name)

		s.DispatchEvent(newEvent(RemovePeerEventType, name, nil))
	}

	// Write the configuration to file.
	s.writeConf()

	return nil
}
900197
func (c *Client) LinodeDelete(linodeID int, skipChecks *bool) error {
	args := make(map[string]interface{})
	args["LinodeID"] = linodeID
	args["skipChecks"] = skipChecks

	_, err := c.apiCall("linode.delete", args)
	if err != nil {
		return err
	}

	return nil
}
260141
func (c *Client) TorrentRemove(payload *TorrentRemovePayload) (err error) {
	// Validate
	if payload == nil {
		return errors.New("payload can't be nil")
	}
	// Send payload
	if err = c.rpcCall("torrent-remove", payload, nil); err != nil {
		return fmt.Errorf("'torrent-remove' rpc method failed: %v", err)
	}
	return
}
512655
func (r *rootRotationReconciler) DeleteNode(node *api.Node) {
	r.mu.Lock()
	delete(r.unconvergedNodes, node.ID)
	r.mu.Unlock()
}
706525
func (c *cluster) removeNode(nodeID string) error {
	// remove from cluster
	c.removeNodeBasicSorted(nodeID)

	// remove from topology
	if c.Topology == nil {
		return fmt.Errorf("Cluster.Topology is nil")
	}
	if !c.Topology.removeID(nodeID) {
		return nil
	}

	// save topology
	return c.saveTopology()
}