removeForPeer method

List<SessionRoute> removeForPeer(
  1. String peerId
)

Removes and returns every route touching the peer connection peerId (used when a client or node disconnects).

Implementation

List<SessionRoute> removeForPeer(String peerId) {
  final affected = _bySession.values
      .where((r) => r.client.id == peerId || r.node.id == peerId)
      .toList();
  for (final route in affected) {
    remove(route.sessionId);
  }
  return affected;
}