public async Task <ISameNodeDetectionToken> GetToken(IEnumerableAsync <MessagePrefixesPair[]> input) { var processIdTask = processIdDetector.DetectProcessId(input); var candidateTypeInfo = webRtcStateInspector.CandidateTypeInfo; var candidateEventsTask = webRtcStateInspector.GetEvents(input).SelectMany( evts => evts.Where(e => e.ObjectType == candidateTypeInfo)).ToList(); var logsTask = GetLogs(input); await Task.WhenAll(processIdTask, candidateEventsTask, logsTask); if (processIdTask.Result.Length == 0) { return(new NullNodeDetectionToken()); } var iceCandidates = candidateEventsTask.Result.ToDictionarySafe(e => e.ObjectId, e => e, (e, e2) => e); if (iceCandidates.Count == 0 && logsTask.Result.Count == 0) { return(new NullNodeDetectionToken()); } return(new NodeDetectionToken( processIdTask.Result, iceCandidates.Select(c => new NodeDetectionToken.ICECandidateInfo(c.Key, ((ITriggerTime)c.Value.Trigger).Timestamp)), logsTask.Result )); }
public async Task <ISameNodeDetectionToken> GetToken(IEnumerableAsync <MessagePrefixesPair <Message>[]> input) { var processIdTask = processIdDetector.DetectProcessId(input); var logsTask = GetLogs(input); await Task.WhenAll(processIdTask, logsTask); if (processIdTask.Result.Length == 0 || logsTask.Result.Count == 0) { return(new NullNodeDetectionToken()); } return(new NodeDetectionToken( processIdTask.Result, null, logsTask.Result )); }