internal bool IsPinnedSendPayloadBuffer(Interop.WebSocket.Buffer buffer,
WebSocketProtocolComponent.BufferType bufferType)
{
if (_sendBufferState != SendBufferState.SendPayloadSpecified)
{
return false;
}
IntPtr bufferData;
uint bufferSize;
UnwrapWebSocketBuffer(buffer, bufferType, out bufferData, out bufferSize);
long nativeBufferStartAddress = bufferData.ToInt64();
long nativeBufferEndAddress = nativeBufferStartAddress + bufferSize;
return nativeBufferStartAddress >= _pinnedSendBufferStartAddress &&
nativeBufferEndAddress >= _pinnedSendBufferStartAddress &&
nativeBufferStartAddress <= _pinnedSendBufferEndAddress &&
nativeBufferEndAddress <= _pinnedSendBufferEndAddress;
}