private static void StartSenders(CancellationToken token, Sender[] senders, Task<long>[] senderTasks) { for (int i = 0; i < senderTasks.Length; ++i) { senderTasks[i] = senders[i].RunAsync(token); } }
private Task<long> StartSendersAndReceiver(CancellationToken token, Sender[] senders, ValidatingReceiver receiver, Task<long>[] senderTasks) { Task<long> receiverTask; if (this.sendBeforeReceive) { StartSenders(token, senders, senderTasks); receiverTask = receiver.RunAsync(); } else { receiverTask = receiver.RunAsync(); StartSenders(token, senders, senderTasks); } return receiverTask; }
private Sender[] CreateSenders(MemoryChannel channel, int[] sentDataSizes, DataOracle oracle) { Sender[] senders = new Sender[this.senderCount]; for (int i = 0; i < senders.Length; ++i) { int bufferSize = sentDataSizes[i % sentDataSizes.Length]; byte fill = (byte)(i + 1); senders[i] = new Sender(channel, this.logger, bufferSize, fill, new Delay(2, 1)); oracle.AddPattern(fill, bufferSize); } return senders; }