public void SendBroadcast(C ctx, DispatchAttribute attr) { lock (this._lockServer) { if (this._handler != null) { try { byte[] array = this._handler.BuildBroadcast(attr); if (array != null) { this.StartSend(ctx, array); } } catch (Exception ex) { if (ctx._sock != null && ctx._sock.Connected) { ctx._sock.Close(); } Common.WriteLine("SendBroadcast failed: {0}", new string[] { ex.Message }); } } } }
public void AddBindings(DispatchAttribute attrib) { this._modifiedSinceLastRequest |= (uint)attrib.type; if (!string.IsNullOrEmpty(attrib.operation) || !string.IsNullOrEmpty(attrib.attached) || !string.IsNullOrEmpty(attrib.guid) || !string.IsNullOrEmpty(attrib.alltype)) { this._UpdateBindings.Add(attrib); } }
public override void DispatchDataset(DispatchAttribute attrib) { lock (this.thisClientLock) { if (!this._context._sock.Connected) { this._context._datasetRequestQueue.Clear(); this._context._curDispatchAttrib = null; } else { if (this._context._curDispatchAttrib != null) { this._context._datasetRequestQueue.Enqueue(attrib); Common.WriteLine(" (C)Dispatch pending, push data in queue: type={0}, uid={1}, {2} bytes", new string[] { this._context._curDispatchAttrib.type.ToString("X8"), this._context._curDispatchAttrib.uid.ToString(), this._context._curDispatchAttrib.data.Length.ToString() }); } else { this._context._curDispatchAttrib = attrib; if (this._context._curDispatchAttrib.data != null) { if (this.semDispatchDataSet != null) { this.semDispatchDataSet.Set(); } long num = Common.ElapsedTime(this._context._curDispatchAttrib.tStart); Common.WriteLine(" New Dispatch: type={0}, uid={1}, {2} bytes, Elapsed={3}", new string[] { this._context._curDispatchAttrib.type.ToString("X8"), this._context._curDispatchAttrib.uid.ToString(), this._context._curDispatchAttrib.data.Length.ToString(), num.ToString() }); } else { this._context._curDispatchAttrib = null; } } } } }
public override void DispatchDataset(DispatchAttribute attrib) { lock (this._lockServer) { if (attrib != null) { if (this._connections.Count > 0) { if ((attrib.type & 8) != 0) { SessionAPI.AuthorizationUpdate(""); } using (Dictionary <Socket, C> .Enumerator enumerator = this._connections.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <Socket, C> current = enumerator.Current; C value = current.Value; if ((attrib.uid == 0 && value._vid == 0L) || ((long)attrib.uid == value._uid && (long)attrib.vid == value._vid)) { if (attrib.uid == 0 && (attrib.type & 8192) == 0 && SessionAPI.IsUserUAC(value._uid)) { DispatchAttribute copy = attrib.getCopy(); copy.uid = (int)value._uid; SessionAPI.toTracker(copy); if (this._handler != null) { this._handler.AutoPull4UAC(value); } } else { if ((attrib.type & 8192) != 0) { bool flag2 = true; if (attrib.uid == 0 && attrib.operation.StartsWith("USER:"******":"); if (num >= 0) { string text = attrib.operation.Substring(num + 1).Trim(); if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(value._userName) || !text.Equals(value._userName, StringComparison.CurrentCultureIgnoreCase)) { flag2 = false; } } } if (flag2) { this.SendBroadcast(value, attrib); } } else { if (attrib.data != null) { bool flag3 = false; if (attrib.type == 1 && value._isRealTimePending) { if (attrib.discard_if_jam <= 0) { Common.WriteLine("XXXXXXXXXXXXXX Important Realtime data can not be discarded", new string[0]); } else { flag3 = true; string text2 = ""; if (value._curDispatchAttrib != null) { text2 += value._curDispatchAttrib.type.ToString(); } int num2 = 0; foreach (DispatchAttribute current2 in value._datasetRequestQueue) { if (num2 == 0) { text2 += ":"; } else { text2 += ","; } text2 += current2.type; num2++; } Common.WriteLine("XXXXXXXXXXXXXX Realtime data is already on the way @DispatchDataset({0}), data discarded", new string[] { text2 }); } } if (!flag3) { DispatchAttribute copy2 = attrib.getCopy(); if (value.setDataSet(copy2)) { this.StartDispatch(value); } } } } } } } goto IL_315; } } Common.WriteLine("Dispatch to Nobody", new string[0]); } IL_315 :; } }
public static void DecompressThread(object threadInfo) { DispatchAttribute dispatchAttribute = (DispatchAttribute)threadInfo; byte[] data = dispatchAttribute.data; byte[] array = null; try { int num = 0; int num2 = dispatchAttribute.data.Length; if (dispatchAttribute.type == 1024) { long cid = BitConverter.ToInt64(dispatchAttribute.data, 0); dispatchAttribute.cid = cid; num = 8; num2 -= 8; } if (dispatchAttribute.algorithm != 2) { if (dispatchAttribute.algorithm == 1) { try { using (MemoryStream memoryStream = new MemoryStream(data, num, num2)) { GZipStream gZipStream = new GZipStream(memoryStream, CompressionMode.Decompress); MemoryStream memoryStream2 = new MemoryStream(); gZipStream.CopyTo(memoryStream2); memoryStream.Close(); memoryStream2.Close(); memoryStream2.Close(); array = memoryStream2.ToArray(); gZipStream.Dispose(); memoryStream.Dispose(); memoryStream2.Dispose(); } goto IL_E7; } catch (Exception) { array = null; goto IL_E7; } } if (dispatchAttribute.algorithm == 0) { array = new byte[num2]; Array.Copy(data, num, array, 0, num2); } } IL_E7 :; } catch (Exception ex) { Common.WriteLine("DecompressThread: {0}", new string[] { ex.Message }); array = null; } if (array == null || array.Length == 0) { return; } double num3 = (double)array.Length; num3 /= (double)data.Length; if (dispatchAttribute.cbCallBack != null) { dispatchAttribute.data = array; dispatchAttribute.cbCallBack(dispatchAttribute); } }
public static void CompressThread(object threadInfo) { DispatchAttribute dispatchAttribute = (DispatchAttribute)threadInfo; byte[] data = dispatchAttribute.data; byte[] array = null; if (DispatchAPI.IsLocalConnection()) { dispatchAttribute.algorithm = 0; } try { using (MemoryStream memoryStream = new MemoryStream()) { if (dispatchAttribute.algorithm != 2) { if (dispatchAttribute.algorithm == 1) { using (GZipStream gZipStream = new GZipStream(memoryStream, CompressionMode.Compress)) { gZipStream.Write(data, 0, data.Length); gZipStream.Close(); memoryStream.Close(); array = memoryStream.ToArray(); gZipStream.Dispose(); memoryStream.Dispose(); goto IL_8E; } } if (dispatchAttribute.algorithm == 0) { array = dispatchAttribute.data; } } IL_8E :; } } catch (Exception ex) { Common.WriteLine("CompressThread: " + ex.Message, new string[0]); array = null; } if (array == null || array.Length == 0) { return; } double num = (double)array.Length; num /= (double)data.Length; if (array != null) { if (dispatchAttribute.type == 1024) { byte[] bytes = BitConverter.GetBytes(dispatchAttribute.cid); byte[] array2 = new byte[8 + array.Length]; Array.Copy(bytes, 0, array2, 0, bytes.Length); Array.Copy(array, 0, array2, 8, array.Length); array = array2; } dispatchAttribute.data = array; if (dispatchAttribute.cbCacheProcess != null) { dispatchAttribute.cbCacheProcess(dispatchAttribute); } if (dispatchAttribute.cbCallBack != null) { dispatchAttribute.cbCallBack(dispatchAttribute); } } }
public virtual void DispatchDataset(DispatchAttribute attr) { }
public virtual void ToAllDispatcher(DispatchAttribute attrib) { }
public virtual byte[] BuildNextDispatch(DispatchAttribute attr) { return(null); }
public virtual byte[] BuildBroadcast(DispatchAttribute attr) { return(null); }
public override byte[] BuildNextDispatch(DispatchAttribute attr) { return(null); }