Example #1
0
 public async Task <HandlerResult> Start(CancellationToken cancellationToken)
 {
     using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, isStopped.Token)) {
         try {
             await connection.Run(cts.Token).ConfigureAwait(false);
         }
         finally {
             this.channel?.RemoveOutputStream(this);
         }
         return(HandlerResult.Close);
     }
 }
 public Task <HandlerResult> Start()
 {
     connectionTask =
         connection.Run(cancelSource.Token)
         .ContinueWith(task => {
         if (this.channel != null)
         {
             this.channel.RemoveOutputStream(this);
         }
         return(HandlerResult.Close);
     });
     return(connectionTask);
 }