예제 #1
0
        private void SendLoop()
        {
            while (true)
            {
                if (_sendQueue.IsEmpty() == false)
                {
                    Client client   = new Client(ActiveConnection, _logger);
                    var    nextFile = _sendQueue.Front();

                    // don't send a file that we are currently receiving.  Instead,
                    //wait for file to complete before sending.
                    if (_receivingFiles.ContainsKey(nextFile.Path) == false)
                    {
                        var result = client.SendFile(nextFile);
                        if (result.WasSuccessful == true)
                        {
                            lock (_sendQueue)
                            {
                                _sendQueue.Dequeue();
                            }
                        }
                    }
                    else
                    {
                        Thread.Sleep(100);
                    }
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
        }