removeStaleEndpoints method
Deletes the endpoint files a dead instance left (only after acquire).
Implementation
Future<void> removeStaleEndpoints() async {
// A socket is not a File to `exists`; its type is asked instead.
for (final name in endpointFiles) {
if (await FileSystemEntity.type(name, followLinks: false) !=
FileSystemEntityType.notFound) {
await File(name).delete();
}
}
}