Ejemplo n.º 1
0
 public FakeConnection(OperationAsyncState state, EndPoint endPoint, Socket socket) : this()
 {
     Identity = Guid.NewGuid();
     State    = state;
     EndPoint = endPoint;
     Socket   = socket;
 }
Ejemplo n.º 2
0
        private static void CreateBody(OperationAsyncState state)
        {
            var buffer = state.Data.GetBuffer();

            state.Body = new OperationBody
            {
                Extras = new ArraySegment <byte>(buffer, OperationBase <object> .HeaderLength, state.Header.ExtrasLength).Array,
                Data   = new ArraySegment <byte>(buffer, 28, state.Header.BodyLength).Array,
            };
        }
Ejemplo n.º 3
0
        private void CreateHeader(OperationAsyncState state)
        {
            var buffer = state.Data.GetBuffer();

            if (buffer.Length > 0)
            {
                state.Header = new OperationHeader
                {
                    Magic         = _converter.ToByte(buffer, HeaderIndexFor.Magic),
                    OperationCode = _converter.ToByte(buffer, HeaderIndexFor.Opcode).ToOpCode(),
                    KeyLength     = _converter.ToInt16(buffer, HeaderIndexFor.KeyLength),
                    ExtrasLength  = _converter.ToByte(buffer, HeaderIndexFor.ExtrasLength),
                    Status        = (ResponseStatus)_converter.ToInt16(buffer, HeaderIndexFor.Status),
                    BodyLength    = _converter.ToInt32(buffer, HeaderIndexFor.Body),
                    Opaque        = _converter.ToUInt32(buffer, HeaderIndexFor.Opaque),
                    Cas           = _converter.ToUInt64(buffer, HeaderIndexFor.Cas)
                };
            }
        }