private DecodeResult EightByteSizeReady() { m_tmpbuf.Reset(); // The payload size is encoded as 64-bit unsigned integer. // The most significant byte comes first. ulong msgSize = m_tmpbuf.GetUnsignedLong(Endian, 0); // Message size must not exceed the maximum allowed size. if (m_maxmsgsize >= 0 && msgSize > (ulong)m_maxmsgsize) { return(DecodeResult.Error); } // TODO: move this constant to a good place (0x7FFFFFC7) // Message size must fit within range of size_t data type. if (msgSize > 0x7FFFFFC7) { return(DecodeResult.Error); } // in_progress is initialised at this point so in theory we should // close it before calling init_size, however, it's a 0-byte // message and thus we can treat it as uninitialised. m_inProgress.InitPool((int)msgSize); m_inProgress.SetFlags(m_msgFlags); NextStep(new ByteArraySegment(m_inProgress.Data, m_inProgress.Offset), m_inProgress.Size, MessageReadyState); return(DecodeResult.Processing); }