Beispiel #1
0
 private static void HandleFuture(Task task, ChunkedWriteHandler <T> owner, IChannel channel, PendingWrite currentWrite, bool resume)
 {
     if (task.IsSuccess())
     {
         var chunks = (IChunkedInput <T>)currentWrite.Message;
         currentWrite.Progress(chunks.Progress, chunks.Length);
         if (resume && channel.IsWritable)
         {
             owner.ResumeTransfer();
         }
     }
     else
     {
         CloseInput((IChunkedInput <T>)currentWrite.Message);
         currentWrite.Fail(task.Exception);
     }
 }
Beispiel #2
0
 private static void HandleEndOfInputFuture(Task task, PendingWrite currentWrite)
 {
     if (task.IsSuccess())
     {
         var chunks = (IChunkedInput <T>)currentWrite.Message;
         // read state of the input in local variables before closing it
         long inputProgress = chunks.Progress;
         long inputLength   = chunks.Length;
         CloseInput(chunks);
         currentWrite.Progress(inputProgress, inputLength);
         currentWrite.Success(inputLength);
     }
     else
     {
         CloseInput((IChunkedInput <T>)currentWrite.Message);
         currentWrite.Fail(task.Exception);
     }
 }