From 5fa0f8548cc55569a42bc4449bacf418a833103e Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Wed, 4 Jan 2017 01:26:15 +0100 Subject: [PATCH] Added debug code --- Backend/CommsTransmitter.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Backend/CommsTransmitter.cs b/Backend/CommsTransmitter.cs index da441422..2da48895 100644 --- a/Backend/CommsTransmitter.cs +++ b/Backend/CommsTransmitter.cs @@ -6,6 +6,7 @@ using Swarmops.Utility.Communications; using System.Reflection; using Swarmops.Logic.Structure; using Swarmops.Logic.Swarm; +using Swarmops.Utility.BotCode; namespace Swarmops.Backend { @@ -17,13 +18,20 @@ namespace Swarmops.Backend foreach (OutboundComm comm in comms) { + BotLog.Write(1, "CommsTx", "OutboundComm #" + comm.Identity.ToString("N0")); + if (!comm.Resolved) { + BotLog.Write(2, "CommsTx", "--resolving"); + ICommsResolver resolver = FindResolver(comm); resolver.Resolve(comm); comm.Resolved = true; - if (comm.Recipients.Count > 1) + int recipientCount = comm.Recipients.Count; + BotLog.Write(2, "CommsTx", "--resolved to " + recipientCount.ToString("N0") + " recipients"); + + if (recipientCount > 1) { // "Your message has been queued for delivery and the recipients have been resolved. // Your mail will be sent to, or be attempted to sent to, [RecipientCount] people in [Geography] in [OrganizationName]." @@ -55,6 +63,8 @@ namespace Swarmops.Backend OutboundCommRecipients recipients = comm.Recipients; PayloadEnvelope envelope = PayloadEnvelope.FromXml (comm.PayloadXml); + BotLog.Write(2, "CommsTx", "--transmitting to " + recipients.Count.ToString("N0") + " recipients"); + comm.StartTransmission(); foreach (OutboundCommRecipient recipient in recipients) @@ -72,8 +82,12 @@ namespace Swarmops.Backend comm.Open = false; + BotLog.Write(2, "CommsTx", "--closing"); + if (comm.RecipientsFail + comm.RecipientsSuccess > 1) { + BotLog.Write(2, "CommsTx", "--notifying"); + ICommsResolver resolver = FindResolver(comm); // "Your message to [GeographyName] has been sent to all scheduled recipients. Of the [RecipientCount] planned recipients,