1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-09 17:06:19 +00:00
This commit is contained in:
JKorf 2024-02-04 17:42:10 +01:00
parent 3fa8277a30
commit 99df7cc792

View File

@ -244,7 +244,7 @@ namespace CryptoExchange.Net.Sockets
} }
/// <summary> /// <summary>
/// Handler for a socket losing conenction and starting reconnect /// Handler for a socket losing connection and starting reconnect
/// </summary> /// </summary>
protected virtual Task HandleReconnectingAsync() protected virtual Task HandleReconnectingAsync()
{ {
@ -378,7 +378,7 @@ namespace CryptoExchange.Net.Sockets
_logger.LogTrace("[Sckt {SocketId}] received {Data}", SocketId, originalData); _logger.LogTrace("[Sckt {SocketId}] received {Data}", SocketId, originalData);
} }
// 3. Determine the subscription interested in the messsage // 3. Determine the identifying properties of this message
var listenId = ApiClient.GetListenerIdentifier(_accessor); var listenId = ApiClient.GetListenerIdentifier(_accessor);
if (listenId == null) if (listenId == null)
{ {
@ -399,7 +399,7 @@ namespace CryptoExchange.Net.Sockets
{ {
if (!ApiClient.UnhandledMessageExpected) if (!ApiClient.UnhandledMessageExpected)
{ {
_logger.LogWarning("[Sckt {SocketId}] received message not matched to any processor. ListenId: {ListenId}", SocketId, listenId); _logger.LogWarning("[Sckt {SocketId}] received message not matched to any listener. ListenId: {ListenId}", SocketId, listenId);
UnhandledMessage?.Invoke(_accessor); UnhandledMessage?.Invoke(_accessor);
} }
@ -407,7 +407,7 @@ namespace CryptoExchange.Net.Sockets
return; return;
} }
_logger.LogTrace("[Sckt {SocketId}] {Count} processors matched to message with listener identifier {ListenerId}", SocketId, processors.Count, listenId); _logger.LogTrace("[Sckt {SocketId}] {Count} processor(s) matched to message with listener identifier {ListenerId}", SocketId, processors.Count, listenId);
var totalUserTime = 0; var totalUserTime = 0;
Dictionary<Type, object>? desCache = null; Dictionary<Type, object>? desCache = null;
if (processors.Count > 1) if (processors.Count > 1)
@ -609,16 +609,6 @@ namespace CryptoExchange.Net.Sockets
return _listeners.OfType<Subscription>().SingleOrDefault(s => s.Id == id); return _listeners.OfType<Subscription>().SingleOrDefault(s => s.Id == id);
} }
/// <summary>
/// Get a subscription on this connection by its subscribe request
/// </summary>
/// <param name="predicate">Filter for a request</param>
/// <returns></returns>
public Subscription? GetSubscriptionByRequest(Func<object?, bool> predicate)
{
lock (_listenersLock)
return _listeners.OfType<Subscription>().SingleOrDefault(s => predicate(s));
}
/// <summary> /// <summary>
/// Send a query request and wait for an answer /// Send a query request and wait for an answer
/// </summary> /// </summary>