Beispiel #1
0
 private void ReceiveIteration(RequestStopHandler stop)
 {
     if (Receive(out var messages, EndOfLineByte))
     {
         // There can be multiple messages bundled into a single receive
         foreach (var message in messages.Split('\n'))
         {
             OnMessageReceived(message);
         }
     }
 }
Beispiel #2
0
        private void ReconnectIteration(RequestStopHandler stop)
        {
            BeforeReconnect();

            Log.Debug("Trying to reconnect to {HostName}:{Port}", _hostName, _port);

            if (TryReconnect())
            {
                Log.Debug("Successfully reconnected to {HostName}:{Port}", _hostName, _port);

                IsConnected = true;
                OnConnection(true);

                AfterReconnect();

                // Stop reconnect loop, successfully reconnected
                stop();
            }
        }
Beispiel #3
0
        private void EventProcessingIteration(RequestStopHandler requestStopHandler)
        {
            if (!_eventQueue.TryTake(out var pluginEvent, 100))
            {
                return;
            }

            switch (pluginEvent.PluginEventType)
            {
            case PluginEventType.Change:
                ChangeMessage?.Invoke(pluginEvent.Data);
                break;

            case PluginEventType.Module:
                ModuleMessage?.Invoke(pluginEvent.Data);
                break;

            default:
                Log.Error("Unknown event type received in {@Event}", pluginEvent);
                break;
            }
        }