internal CAsyncResult(CAsyncServiceHandler ash, ushort sReqId, CUQueue q, CAsyncServiceHandler.DAsyncResultHandler arh) { m_AsyncServiceHandler = ash; m_RequestId = sReqId; m_UQueue = q; m_CurrentAsyncResultHandler = arh; }
private bool DataFromServerToClient(CAsyncServiceHandler sender, ushort reqId, CUQueue qData) { bool processed = false; switch (reqId) { case CStreamSerializationHelper.idReadDataFromServerToClient: if (qData.GetSize() > 0) { lock (m_cs) { CStreamSerializationHelper.Write(m_s, qData); if (Progress != null) { Progress.Invoke(this, (ulong)m_s.Position); } } qData.SetSize(0); processed = true; } break; default: break; } return(processed); }
protected override void OnMergeTo(CAsyncServiceHandler to) { CStreamingFile fTo = (CStreamingFile)to; lock (fTo.m_csFile) { int pos = 0; int count = fTo.m_vContext.Count; foreach (CContext cxt in fTo.m_vContext) { if (cxt.ErrCode == 0 && cxt.ErrMsg.Length == 0 && cxt.File == null) { break; } ++pos; } lock (m_csFile) { fTo.m_vContext.InsertRange(pos, m_vContext); m_vContext.Clear(); } if (count == 0 && fTo.m_vContext.Count > 0) { ClientCoreLoader.PostProcessing(fTo.Socket.Handle, 0, 0); fTo.Socket.DoEcho(); //make sure WaitAll works correctly } } }
internal void Detach(CAsyncServiceHandler ash) { if (ash == null) return; m_lstAsh.Remove(ash); ash.SetNull(); }
public CStreamHelper(CAsyncServiceHandler ash) { if (ash == null) { throw new ArgumentNullException("A valid service handler required"); } m_ash = ash; }
protected override void OnMergeTo(CAsyncServiceHandler to) { CStreamingFile fTo = (CStreamingFile)to; lock (fTo.m_csFile) { lock (m_csFile) { fTo.m_vContext.InsertRange(fTo.m_vContext.Count, m_vContext); m_vContext.Clear(); } } }
internal bool Attach(CAsyncServiceHandler ash) { if (ash == null) return false; foreach (CAsyncServiceHandler h in m_lstAsh) { if (ash.SvsID == h.SvsID) return false; } m_lstAsh.Add(ash); return true; }
internal void AppendTo(CAsyncServiceHandler to) { lock (to.m_cs) { lock (m_cs) { OnMergeTo(to); to.m_kvCallback.InsertRange(to.m_kvCallback.Count, m_kvCallback); m_kvCallback.Clear(); } } }
protected override void OnMergeTo(CAsyncServiceHandler to) { CCachedBaseHandler dbTo = (CCachedBaseHandler)to; lock (dbTo.m_csCache) { lock (m_csCache) { foreach (ulong callIndex in m_mapRowset.Keys) { dbTo.m_mapRowset.Add(callIndex, m_mapRowset[callIndex]); } m_mapRowset.Clear(); } } }
protected virtual void OnMergeTo(CAsyncServiceHandler to) { }
private bool DataFromServerToClient(CAsyncServiceHandler sender, ushort reqId, CUQueue qData) { bool processed = false; switch (reqId) { case CStreamSerializationHelper.idReadDataFromServerToClient: if (qData.GetSize() > 0) { lock (m_cs) { CStreamSerializationHelper.Write(m_s, qData); if (Progress != null) Progress.Invoke(this, (ulong)m_s.Position); } qData.SetSize(0); processed = true; } break; default: break; } return processed; }
private Stream m_s; //protected by m_cs #endregion Fields #region Constructors public CStreamHelper(CAsyncServiceHandler ash) { if (ash == null) throw new ArgumentNullException("A valid service handler required"); m_ash = ash; }