internal virtual InternalZerioConfiguration ToInternalConfiguration() { // const int allocationGranularity = 65536; var configuration = new InternalZerioConfiguration { MaxSendBatchSize = MaxSendBatchSize, SendingBufferLength = SendingBufferLength, SendingBufferCount = SendingBufferCount, ReceivingBufferLength = ReceivingBufferLength, ReceivingBufferCount = ReceivingBufferCount, RequestEngineWaitStrategyType = RequestEngineWaitStrategyType, ReceiveCompletionPollingWaitStrategyType = ReceiveCompletionPollingWaitStrategyType, SendCompletionPollingWaitStrategyType = SendCompletionPollingWaitStrategyType, FramingBufferLength = ReceivingBufferLength, }; var sendBufferCount = InternalZerioConfiguration.GetNextPowerOfTwo(configuration.SendingBufferCount); configuration.RequestQueueMaxOutstandingSends = sendBufferCount; configuration.SendingCompletionQueueSize = sendBufferCount; configuration.MaxSendCompletionResults = sendBufferCount; configuration.SendRequestProcessingEngineRingBufferSize = sendBufferCount; configuration.BatchSendRequests = BatchSendRequests; configuration.ConflateSendRequestsOnProcessing = ConflateSendRequestsOnProcessing; configuration.ConflateSendRequestsOnEnqueuing = ConflateSendRequestsOnEnqueuing; configuration.MaxConflatedSendRequestCount = MaxConflatedSendRequestCount; configuration.MaxReceiveCompletionResults = ReceivingBufferCount; configuration.RequestQueueMaxOutstandingReceives = ReceivingBufferCount; configuration.ReceivingCompletionQueueSize = ReceivingBufferCount; return(configuration); }
public ZerioServer(int listeningPort, ZerioServerConfiguration serverConfiguration = null) { WinSock.EnsureIsInitialized(); _listeningPort = listeningPort; _configuration = CreateConfiguration(serverConfiguration); _completionQueues = CreateCompletionQueues(); _sessionManager = CreateSessionManager(); _sendRequestProcessingEngine = CreateSendRequestProcessingEngine(); _receiveCompletionProcessor = CreateReceiveCompletionProcessor(); _listeningSocket = CreateListeningSocket(); }
public void SetUp() { _configuration = new InternalZerioConfiguration { MaxReceiveCompletionResults = 5, }; _testCompletionQueue = new TestCompletionQueue(); _sessionManagerMock = new Mock <ISessionManager>(); _sessionMock = new Mock <ISession>(); var session = _sessionMock.Object; _sessionManagerMock.Setup(x => x.TryGetSession(_sessionId, out session)).Returns(true); _processor = new ReceiveCompletionProcessor(_configuration, _testCompletionQueue, _sessionManagerMock.Object); }
public ZerioClient(IPEndPoint serverEndpoint, ZerioClientConfiguration clientConfiguration = null) { _serverEndpoint = serverEndpoint; WinSock.EnsureIsInitialized(); _configuration = CreateConfiguration(clientConfiguration); _completionQueues = CreateCompletionQueues(); _sessionManager = CreateSessionManager(); _sendRequestProcessingEngine = CreateSendRequestProcessingEngine(); _receiveCompletionProcessor = CreateReceiveCompletionProcessor(); _session = _sessionManager.Acquire(); _session.HandshakeReceived += OnHandshakeReceived; _session.Closed += OnSessionClosed; }