public void WriteUnbufferedMessage(MemoryStream bufferWithOffset, MemoryStream memAck = null) { if (Closed || string.IsNullOrEmpty(Signature) || Band.Failed()) { return; } var message = GlobalPool <MessageUnbuffered> .GetObject(bufferWithOffset, memAck); _messages.Enqueue(message); Flush(); }
public static SocketAsyncEventArgs CreateOrGetSocketAsyncEventArgs(this IOHandler ioHandler) { SocketAsyncEventArgs saea; if (!GlobalPool <SocketAsyncEventArgs> .GetObject(out saea)) { saea.Completed += saeCompleted; } saea.UserToken = ioHandler; return(saea); }
public Channel GetChannel(uint id) { if (!_channels.ContainsKey(id)) { Channel result; if (GlobalPool <Channel> .GetObject(out result, id)) { result.id = id; } _channels[id] = result; } return(_channels[id]); }
public AESEngine Next(AESType t) { AESEngine next; if (GlobalPool <AESEngine> .GetObject(out next, this, t)) { next.Type = Type == AESType.EMPTY ? AESType.EMPTY : t; next._key = _key; next._direction = _direction; } else { next._canRecycle = true; } return(next); }
private Variant ToPrimitives(List <DirtyInfo> info) { var vm = GlobalPool <VariantMap> .GetObject(); var result = Variant.Get(vm); vm.IsArray = true; vm.ArrayLength = info.Count; for (var i = 0; i < vm.ArrayLength; i++) { var primitive = Variant.GetMap(new VariantMapHelper { { Defines.RM_SHAREDOBJECTPRIMITIVE_TYPE, info[i].Type } }); switch (info[i].Type) { case Defines.SOT_SC_UPDATE_DATA_ACK: case Defines.SOT_SC_DELETE_DATA: primitive[Defines.RM_SHAREDOBJECTPRIMITIVE_PAYLOAD] = Variant.GetList(info[i].PropertyName); break; case Defines.SOT_SC_UPDATE_DATA: primitive[Defines.RM_SHAREDOBJECTPRIMITIVE_PAYLOAD] = Variant.GetMap(new VariantMapHelper { { info[i].PropertyName, Payload[info[i].PropertyName].Clone() } }); break; case Defines.SOT_SC_INITIAL_DATA: case Defines.SOT_SC_CLEAR_DATA: break; default: Logger.ASSERT("Unable to handle primitive type:{0}", info[i].Type); break; } vm[VariantMap.GetIndexString(i)] = primitive; } return(result); }
private MessageBuffered CreateBufferedMessage() { if (Closed || string.IsNullOrEmpty(Signature) || Band.Failed()) { return(_MessageNull); } MessageBuffered message; if (GlobalPool <MessageBuffered> .GetObject(out message, Reliable)) { message.Repeatable = Reliable; } if (_transaction) { _tempMessages.Enqueue(message); } else { _messages.Enqueue(message); } return(message); }