viewPeer<T> method
ViewPeer views the resource management scope for a specific peer.
Implementation
@override
Future<T> viewPeer<T>(PeerId peer, Future<T> Function(PeerScope scope) f) async {
// Assuming PeerId can be used where PeerId is expected
final scope = getPeerScopeInternal(peer);
// Hold the scope while [f] runs, so that gc() does not drop it.
scope.incRef();
try {
return await f(scope);
} finally {
scope.decRef();
}
}