internal override void CopyEventHandler(Message src) { base.CopyEventHandler(src); Request srcReq = src as Request; if (srcReq != null) { ForEach(srcReq.Respond, h => this.Respond += h); ForEach(srcReq.Responding, h => this.Responding += h); } }
public void ProactiveCancel() { Request cancel = Request.NewGet(); // copy options, but set Observe to cancel cancel.SetOptions(_request.GetOptions()); cancel.MarkObserveCancel(); // use same Token cancel.Token = _request.Token; cancel.Destination = _request.Destination; // dispatch final response to the same message observers cancel.CopyEventHandler(_request); cancel.Send(_endpoint); // cancel old ongoing request _request.IsCancelled = true; _canceled = true; }