removeSub method
Implementation
Future<void> removeSub(PeerId p, AddrSub s) async {
await _lock.synchronized( ()async {
final peerKey = p.toString();
final subs = _subs[peerKey];
if (subs == null || subs.isEmpty) {
return;
}
if (subs.length == 1) {
if (subs[0] != s) {
return;
}
_subs.remove(peerKey);
return;
}
final index = subs.indexOf(s);
if (index != -1) {
subs.removeAt(index);
}
});
}