Ejemplo n.º 1
0
 internal SynReqArgs(byte *buffer, int offset, int size, SynReqHandler handler)
 {
     Buffer         = buffer;
     Offset         = offset;
     Size           = size;
     RequestHandler = handler;
 }
Ejemplo n.º 2
0
 public bool RegisterPreservedMessageHandler(ushort msgId, SynReqHandler message_handler)
 {
     try
     {
         preserved_sync_handlers[msgId] = message_handler;
         Log.WriteLine(LogLevel.Debug, "Preserved sync message " + msgId + " is registered.");
         return(true);
     }
     catch (Exception ex)
     {
         Trinity.Diagnostics.Log.WriteLine(ex.Message);
         Trinity.Diagnostics.Log.WriteLine(ex.StackTrace);
         return(false);
     }
 }
Ejemplo n.º 3
0
        public bool RegisterMessageHandler(ushort msgId, SynReqHandler message_handler)
        {
            try
            {
                sync_handlers[msgId] = message_handler;

                var messageHandlerMethodName = message_handler.Method.Name;

                Log.WriteLine(LogLevel.Debug, $"Sync (response) Message Handler: {messageHandlerMethodName}. MessageID: {msgId.ToString()} is registered.");
                return(true);
            }
            catch (Exception ex)
            {
                Trinity.Diagnostics.Log.WriteLine(ex.Message);
                Trinity.Diagnostics.Log.WriteLine(ex.StackTrace);
                return(false);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Registers a preserved synchronous message handler.
 /// </summary>
 /// <param name="msgId">A 16-bit unsigned message id.</param>
 /// <param name="message_handler">A message hander for a synchronous protocol without response.</param>
 public static void RegisterPreservedMessageHandler(ushort msgId, SynReqHandler message_handler)
 {
     MessageHandlers.DefaultParser.RegisterPreservedMessageHandler(msgId, message_handler);
 }