private void SendDispatchLoop() { while (true) { if (scheduler.Verbose) { Console.WriteLine("Waiting for the next send to dispatch"); } SendTask sendTask = sendQueue.Receive(); if (scheduler.Verbose) { Console.WriteLine("Dispatching send of message of size {0} to {1}", sendTask.Message.Length, IoScheduler.PublicKeyToString(sendTask.DestinationPublicKey)); } SenderThread senderThread = scheduler.FindSenderForDestinationPublicKey(sendTask.DestinationPublicKey); if (senderThread == null) { senderThread = ClientSenderThread.Create(scheduler, sendTask.DestinationPublicKey); } senderThread.EnqueueSendTask(sendTask); } }
/////////////////////////////////// // Extra API calls for client /////////////////////////////////// public void Connect(byte[] destinationPublicKey) { SenderThread senderThread = FindSenderForDestinationPublicKey(destinationPublicKey); if (senderThread == null) { senderThread = ClientSenderThread.Create(this, destinationPublicKey); } }