private void OnStartRawRead(Action <HttpVirtualTransportServerHandleResult[]> OnSuccess, Action OnFailure) { HttpWriteContext PairWriteContext = null; WriteContext.Update(c => { if (c != null) { PairWriteContext = c; } return(null); }); if (PairWriteContext != null) { HandleRawWrite(PairWriteContext.ListenerContext, PairWriteContext.NewSessionId, PairWriteContext.Query); } HttpReadContext PairContext = null; var Pushed = true; ReadContext.Update(c => { if (c != null) { if (c.ListenerContext != null) { c.OnSuccess = OnSuccess; c.OnFailure = OnFailure; PairContext = c; Pushed = true; return(null); } else { Pushed = false; return(c); } } Pushed = true; return(new HttpReadContext { ListenerContext = null, NewSessionId = null, OnSuccess = OnSuccess, OnFailure = OnFailure }); }); if (PairContext != null) { HandleRawRead(PairContext.ListenerContext, PairContext.NewSessionId, PairContext.OnSuccess, PairContext.OnFailure); } if (!Pushed) { OnFailure(); } }
private void OnShutdownWrite() { HttpWriteContext PairWriteContext = null; WriteContext.Update(c => { PairWriteContext = c; return(null); }); if (PairWriteContext != null) { HandleRawWrite(PairWriteContext.ListenerContext, PairWriteContext.NewSessionId, PairWriteContext.Query); } }