handles codex events without node or peer
This commit is contained in:
parent
1bd84a4892
commit
672092b232
|
@ -117,10 +117,10 @@ namespace FrameworkTests.OverwatchTranscriptTests
|
||||||
var e = events.SingleOrDefault(e => e.Moment.Utc == utc && e.Payload.EventData == data);
|
var e = events.SingleOrDefault(e => e.Moment.Utc == utc && e.Payload.EventData == data);
|
||||||
if (e == null) Assert.Fail("Event not found");
|
if (e == null) Assert.Fail("Event not found");
|
||||||
|
|
||||||
Assert.That(e.Moment.Utc, Is.EqualTo(utc));
|
Assert.That(e!.Moment.Utc, Is.EqualTo(utc));
|
||||||
Assert.That(e.Moment.Duration, Is.EqualTo(duration));
|
Assert.That(e!.Moment.Duration, Is.EqualTo(duration));
|
||||||
Assert.That(e.Moment.Index, Is.EqualTo(index));
|
Assert.That(e!.Moment.Index, Is.EqualTo(index));
|
||||||
Assert.That(e.Payload.EventData, Is.EqualTo(data));
|
Assert.That(e!.Payload.EventData, Is.EqualTo(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AssertFileContent()
|
private void AssertFileContent()
|
||||||
|
|
|
@ -19,18 +19,19 @@ namespace TranscriptAnalysis.Receivers
|
||||||
Header = header;
|
Header = header;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string GetPeerId(int nodeIndex)
|
protected string? GetPeerId(int nodeIndex)
|
||||||
{
|
{
|
||||||
return GetIdentity(nodeIndex).PeerId;
|
return GetIdentity(nodeIndex)?.PeerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string GetName(int nodeIndex)
|
protected string? GetName(int nodeIndex)
|
||||||
{
|
{
|
||||||
return GetIdentity(nodeIndex).Name;
|
return GetIdentity(nodeIndex)?.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CodexNodeIdentity GetIdentity(int nodeIndex)
|
protected CodexNodeIdentity? GetIdentity(int nodeIndex)
|
||||||
{
|
{
|
||||||
|
if (nodeIndex < 0) return null;
|
||||||
return Header.Nodes[nodeIndex];
|
return Header.Nodes[nodeIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace TranscriptAnalysis.Receivers
|
||||||
{
|
{
|
||||||
var peerId = GetPeerId(@event.Payload.NodeIdentity);
|
var peerId = GetPeerId(@event.Payload.NodeIdentity);
|
||||||
var name = GetName(@event.Payload.NodeIdentity);
|
var name = GetName(@event.Payload.NodeIdentity);
|
||||||
|
if (peerId == null) return;
|
||||||
|
if (name == null) return;
|
||||||
|
|
||||||
if (!seen.Contains(peerId))
|
if (!seen.Contains(peerId))
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace TranscriptAnalysis.Receivers
|
||||||
if (@event.Payload.DialSuccessful != null)
|
if (@event.Payload.DialSuccessful != null)
|
||||||
{
|
{
|
||||||
var peerId = GetPeerId(@event.Payload.NodeIdentity);
|
var peerId = GetPeerId(@event.Payload.NodeIdentity);
|
||||||
|
if (peerId == null) return;
|
||||||
AddDial(peerId, @event.Payload.DialSuccessful.TargetPeerId);
|
AddDial(peerId, @event.Payload.DialSuccessful.TargetPeerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue