Exemple #1
0
 /// <summary>
 /// Called by DccListener when it receives a DCC Accept message.
 /// </summary>
 internal void OnDccAcceptReceived(long position)
 {
     Debug.WriteLineIf(DccUtil.DccTrace.TraceInfo, "[" + Thread.CurrentThread.Name + "] DccFileSession::OnDccAcceptReceived()");
     lock (this)
     {
         //Are we still waiting on the accept?
         if (!waitingOnAccept)
         {
             //Assume that a normal receive has gone ahead
             return;
         }
         //No longer waiting
         waitingOnAccept = false;
         if (!dccFileInfo.AcceptPositionMatches(position))
         {
             dccUserInfo.Connection.Listener.Error(ReplyCode.BadDccAcceptValue, "Asked to start at " + dccFileInfo.FileStartingPosition + " but was sent " + position);
             Interrupted();
             return;
         }
         ResetActivityTimer();
         dccFileInfo.SetResumeToFileSize();
         dccFileInfo.GotoWritePosition();
         thread      = new Thread(new ThreadStart(Download));
         thread.Name = ToString();
         thread.Start();
     }
 }