public void SendMessage(object message)
{
if (connections == null)
return;
this.connections.ForEach(tt =>
{
try
{
using (var ms = new MemoryStream())
{
Serialize(message, ms);
if (!Task.Run(async () => await tt.Item1.SendData(
messageType: message.GetType().FullName,
data: ms.ToArray())).Result)
{
this.log.Debug("Not connected to {0}", tt.Item1.Server);
}
}
}
catch (Exception ex)
{
// Ignore
this.log.Debug("Failed to send: {0}", ex.Message);
}
});
}