1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2026-04-08 10:41:08 +00:00
This commit is contained in:
Jkorf 2026-04-07 16:35:43 +02:00
parent 7c34b62866
commit 0d3ccf25a7
5 changed files with 8 additions and 12 deletions

View File

@ -335,7 +335,9 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
var mappingStringToEnum = new List<EnumMapping>(); var mappingStringToEnum = new List<EnumMapping>();
var mappingEnumToString = new Dictionary<T, string>(); var mappingEnumToString = new Dictionary<T, string>();
#pragma warning disable IL2080
var enumMembers = _enumType.GetFields(); var enumMembers = _enumType.GetFields();
#pragma warning restore IL2080
foreach (var member in enumMembers) foreach (var member in enumMembers)
{ {
var maps = member.GetCustomAttributes(typeof(MapAttribute), false); var maps = member.GetCustomAttributes(typeof(MapAttribute), false);

View File

@ -25,7 +25,8 @@ namespace CryptoExchange.Net.Sockets.Default.Routing
if (!_routeTableEntries.ContainsKey(route.TypeIdentifier)) if (!_routeTableEntries.ContainsKey(route.TypeIdentifier))
_routeTableEntries.Add(route.TypeIdentifier, new RoutingTableEntry(route.DeserializationType)); _routeTableEntries.Add(route.TypeIdentifier, new RoutingTableEntry(route.DeserializationType));
_routeTableEntries[route.TypeIdentifier].Handlers.Add(entry); if (!_routeTableEntries[route.TypeIdentifier].Handlers.Contains(entry))
_routeTableEntries[route.TypeIdentifier].Handlers.Add(entry);
} }
} }
} }

View File

@ -9,11 +9,8 @@ using CryptoExchange.Net.Sockets.Default.Routing;
using CryptoExchange.Net.Sockets.Interfaces; using CryptoExchange.Net.Sockets.Interfaces;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Data;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Net.WebSockets; using System.Net.WebSockets;
using System.Text; using System.Text;
@ -1153,13 +1150,7 @@ namespace CryptoExchange.Net.Sockets.Default
{ {
var updatedList = new List<IMessageProcessor>(_listeners); var updatedList = new List<IMessageProcessor>(_listeners);
updatedList.Add(processor); updatedList.Add(processor);
processor.OnMessageRouterUpdated += () => processor.OnMessageRouterUpdated += BuildRoutingTable;
{
BuildRoutingTable();
#if DEBUG
_logger.LogTrace("MessageRouter updated, new routing table:\r\n" + _routeTable.ToString());
#endif
};
_listeners = updatedList.AsReadOnly(); _listeners = updatedList.AsReadOnly();
if (processor.MessageRouter.Routes.Length > 0) if (processor.MessageRouter.Routes.Length > 0)
{ {

View File

@ -22,7 +22,7 @@ namespace CryptoExchange.Net.Sockets.Interfaces
/// <summary> /// <summary>
/// Event when the message router for this processor has been changed /// Event when the message router for this processor has been changed
/// </summary> /// </summary>
public event Action OnMessageRouterUpdated; public event Action? OnMessageRouterUpdated;
/// <summary> /// <summary>
/// Handle a message /// Handle a message
/// </summary> /// </summary>

View File

@ -48,6 +48,7 @@ namespace CryptoExchange.Net.Testing
/// <param name="methodInvoke">Method invocation</param> /// <param name="methodInvoke">Method invocation</param>
/// <param name="name">Method name for looking up json test values</param> /// <param name="name">Method name for looking up json test values</param>
/// <param name="endpointOptions">Request options</param> /// <param name="endpointOptions">Request options</param>
/// <param name="validation">Callback to validate the response model</param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
public Task ValidateAsync<TResponse>( public Task ValidateAsync<TResponse>(
@ -65,6 +66,7 @@ namespace CryptoExchange.Net.Testing
/// <param name="methodInvoke">Method invocation</param> /// <param name="methodInvoke">Method invocation</param>
/// <param name="name">Method name for looking up json test values</param> /// <param name="name">Method name for looking up json test values</param>
/// <param name="endpointOptions">Request options</param> /// <param name="endpointOptions">Request options</param>
/// <param name="validation">Callback to validate the response model</param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
public async Task ValidateAsync<TResponse, TActualResponse>( public async Task ValidateAsync<TResponse, TActualResponse>(