MessageHandler.MessageHandler renamed to WrapHandler because that's what it does. (#2431)

This commit is contained in:
vis2k 2020-11-16 01:48:33 +08:00 committed by GitHub
parent 1e9a3b03de
commit 14ae0d094d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -59,7 +59,7 @@ public static bool UnpackMessage(NetworkReader messageReader, out int msgType)
} }
// wraps a handler function with extra code // wraps a handler function with extra code
internal static NetworkMessageDelegate MessageHandler<T, C>(Action<C, T> handler, bool requireAuthenication) internal static NetworkMessageDelegate WrapHandler<T, C>(Action<C, T> handler, bool requireAuthenication)
where T : struct, NetworkMessage where T : struct, NetworkMessage
where C : NetworkConnection where C : NetworkConnection
=> (conn, reader, channelId) => => (conn, reader, channelId) =>

View File

@ -315,7 +315,7 @@ public static void RegisterHandler<T>(Action<NetworkConnection, T> handler, bool
{ {
logger.LogWarning($"NetworkClient.RegisterHandler replacing handler for {typeof(T).FullName}, id={msgType}. If replacement is intentional, use ReplaceHandler instead to avoid this warning."); logger.LogWarning($"NetworkClient.RegisterHandler replacing handler for {typeof(T).FullName}, id={msgType}. If replacement is intentional, use ReplaceHandler instead to avoid this warning.");
} }
handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication);
} }
/// <summary> /// <summary>
@ -342,7 +342,7 @@ public static void ReplaceHandler<T>(Action<NetworkConnection, T> handler, bool
where T : struct, NetworkMessage where T : struct, NetworkMessage
{ {
int msgType = MessagePacker.GetId<T>(); int msgType = MessagePacker.GetId<T>();
handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication);
} }
/// <summary> /// <summary>

View File

@ -596,7 +596,7 @@ public static void RegisterHandler<T>(Action<NetworkConnection, T> handler, bool
{ {
logger.LogWarning($"NetworkServer.RegisterHandler replacing handler for {typeof(T).FullName}, id={msgType}. If replacement is intentional, use ReplaceHandler instead to avoid this warning."); logger.LogWarning($"NetworkServer.RegisterHandler replacing handler for {typeof(T).FullName}, id={msgType}. If replacement is intentional, use ReplaceHandler instead to avoid this warning.");
} }
handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication);
} }
/// <summary> /// <summary>
@ -623,7 +623,7 @@ public static void ReplaceHandler<T>(Action<NetworkConnection, T> handler, bool
where T : struct, NetworkMessage where T : struct, NetworkMessage
{ {
int msgType = MessagePacker.GetId<T>(); int msgType = MessagePacker.GetId<T>();
handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication);
} }
/// <summary> /// <summary>