Exemple #1
0
    private void SendTo(ClientManager receiver, IrssMessage message)
    {
      IrssLog.Debug("SendTo({0}, {1})", message.Type, message.Flags);

      if (!_server.Send(receiver, message))
      {
        IrssLog.Warn("Failed to send message to a client, unregistering client");

        // If a message doesn't get through then unregister that client
        UnregisterClient(receiver);
      }
    }
 /// <summary>
 /// Create a new MessageManagerCombo structure instance.
 /// </summary>
 /// <param name="message">The IrssMessage to encapsulate.</param>
 /// <param name="manager">The ClientManager to encapsulate.</param>
 public MessageManagerCombo(IrssMessage message, ClientManager manager)
 {
     _message = message;
     _manager = manager;
 }
Exemple #3
0
    private void SendToAllExcept(ClientManager exceptClient, IrssMessage message)
    {
      IrssLog.Debug("SendToAllExcept({0}, {1})", message.Type, message.Flags);

      List<ClientManager> unregister = new List<ClientManager>();

      lock (_registeredClients)
      {
        foreach (ClientManager client in _registeredClients)
        {
          if (client == exceptClient)
            continue;

          if (!_server.Send(client, message))
          {
            IrssLog.Warn("Failed to send message to a client, unregistering client");

            // If a message doesn't get through then unregister that client
            unregister.Add(client);
          }
        }

        // Unregistering clients must be done as a two part process because otherwise the
        // foreach statement above would fail if you modified the _registeredClients list
        // while enumerating it.
        foreach (ClientManager client in unregister)
        {
          UnregisterClient(client);
        }
      }
    }
Exemple #4
0
    private bool UnregisterRepeater(ClientManager removeRepeater)
    {
      if (_registeredRepeaters == null) return false;

      lock (_registeredRepeaters)
      {
        if (!_registeredRepeaters.Contains(removeRepeater))
          return false;

        _registeredRepeaters.Remove(removeRepeater);
      }

      IrssLog.Info("Unregistered a repeater");
      return true;
    }
Exemple #5
0
    private bool RegisterRepeater(ClientManager addRepeater)
    {
      if (_registeredRepeaters == null) return false;

      lock (_registeredRepeaters)
      {
        if (!_registeredRepeaters.Contains(addRepeater))
          _registeredRepeaters.Add(addRepeater);
      }

      IrssLog.Info("Registered a repeater");
      return true;
    }
Exemple #6
0
    private bool UnregisterClient(ClientManager removeClient)
    {
      if (_registeredClients == null) return false;

      lock (_registeredClients)
      {
        if (!_registeredClients.Contains(removeClient))
          return false;

        _registeredClients.Remove(removeClient);
      }

      IrssLog.Info("Unregistered a client");
      return true;
    }
Exemple #7
0
    private bool RegisterClient(ClientManager addClient)
    {
      if (_registeredClients == null) return false;

      lock (_registeredClients)
      {
        if (!_registeredClients.Contains(addClient))
          _registeredClients.Add(addClient);
      }

      IrssLog.Info("Registered a client");
      return true;
    }