processConnections method
Completes every invitation this atSign accepted whose inviter has confirmed it, decrypting any content, and returns those it completed. The app adds the inviter to its own contacts from these, or from any received invitation whose status is connected.
A record it cannot read, or a confirmation it cannot complete, is logged and skipped, so it cannot hold up the others.
Implementation
Future<List<CItem<ReceivedInvitation>>> processConnections() async {
final connected = <CItem<ReceivedInvitation>>[];
for (final connection in await _readable(await connections)) {
if (connection.owner == me) continue;
try {
final done = await _connect(connection);
if (done != null) connected.add(done);
} on StoppedException {
rethrow;
} catch (e) {
logger.warning(
'Could not complete the invitation ${connection.id} from '
'${connection.owner}: $e',
);
}
}
return connected;
}