public OperationResult DataReceived(int transferred, Direction direction) { var continuation = new OperationContinuation(); continuation.SetOutcome(OperationOutcome.Continue); return(continuation.Result); }
public override OperationResult DataReceived(int transferred, Direction direction) { // Call the base listener and return that value if it's not continue. var result = base.DataReceived(transferred, direction); if (result.Outcome != OperationOutcome.Continue) { return(result); } // Create an operation continuation and schedule it to be ran after // some time. var continuation = new OperationContinuation(); Task.Run(async() => { await Task.Delay(delay); continuation.SetOutcome(OperationOutcome.Continue); }); return(continuation.Result); }