Example #1
0
 /// <summary>
 /// A DCC Send request has already been sent and the remote user
 /// has responded with a Resume request.
 /// </summary>
 /// <param name="resumePosition">The number of bytes the remote user already has..</param>
 /// <exception cref="ArgumentException">If the session is no longer active or the file
 /// resume position was larger than the file.</exception>
 internal void OnDccResumeRequest(long resumePosition)
 {
     Debug.WriteLineIf(DccUtil.DccTrace.TraceInfo, "[" + Thread.CurrentThread.Name + "] DccFileSession::OnDccResumeRequest()");
     lock (this)
     {
         ResetActivityTimer();
         //Make sure we have not already started transfering data and that this file is
         //resumeable.
         if (dccFileInfo.BytesTransfered == 0 && dccFileInfo.CanResume())
         {
             //Make sure the position is valid
             if (dccFileInfo.ResumePositionValid(resumePosition))
             {
                 dccFileInfo.SetResumePosition(resumePosition);
                 SendAccept();
             }
             else
             {
                 dccUser.Connection.Listener.Error(ReplyCode.BadResumePosition, ToString() + " sent an invalid resume position.");
                 //Close the socket and stop listening
                 Cleanup();
             }
         }
     }
 }