Example #1
0
 private void addMessageHandler(BaseMessage msg, ReplyHandlerClass handler)
 {
     if (handler != null)
     {
         m_ipcQueue.AddMessage(msg, handler, 0);
     }
 }
Example #2
0
 public override void PushMessage(BaseMessage msg, ReplyHandlerClass handler = null, int retryNum = 0)
 {
     if (m_waitingForAuth)
     {
         // We'll only allow auth messages through until authentication has
         // been confirmed.
         if (msg.GetType() == typeof(AuthenticationMessage))
         {
             m_server.PushMessage(msg);
             addMessageHandler(msg, handler);
         }
         else if (msg.GetType() == typeof(RelaxedPolicyMessage))
         {
             m_server.PushMessage(msg);
             addMessageHandler(msg, handler);
         }
         else if (msg.GetType() == typeof(NotifyBlockActionMessage))
         {
             m_server.PushMessage(msg);
             addMessageHandler(msg, handler);
         }
     }
     else
     {
         m_server.PushMessage(msg);
     }
 }
 /// <summary>
 /// Adds a message and a handler to the tracker to wait until HandleMessage is called with a reply.
 /// </summary>
 /// <param name="message">The message which was sent to the server</param>
 /// <param name="handler">The handler for the reply message.</param>
 public void AddMessage(BaseMessage message, ReplyHandlerClass handler, int retryNum)
 {
     lock (m_lock)
     {
         m_messageList.Add(new IPCMessageData()
         {
             Message = message, Handler = handler, Retries = retryNum
         });
     }
 }
Example #4
0
        protected override ReplyHandlerClass SendInternal(IpcCall call, object data, BaseMessage replyToThis = null)
        {
            ReplyHandlerClass h = new ReplyHandlerClass(this);

            BaseMessage msg = IpcMessage.Send(call, data);

            msg.ReplyToId = replyToThis?.Id ?? Guid.Empty;

            PushMessage(msg, h);
            return(h);
        }
Example #5
0
        public void RequestConfigUpdate(Action <NotifyConfigUpdateMessage> replyHandler)
        {
            var msg = new RequestConfigUpdateMessage();

            ReplyHandlerClass h = new ReplyHandlerClass(this);

            if (replyHandler != null)
            {
                h.OnBaseReply((reply) =>
                {
                    if (reply.GetType() == typeof(Messages.NotifyConfigUpdateMessage))
                    {
                        replyHandler((Messages.NotifyConfigUpdateMessage)reply);
                    }
                });
            }

            PushMessage(msg, h);
        }
Example #6
0
        public override void PushMessage(BaseMessage msg, ReplyHandlerClass replyHandler = null, int retryNum = 0)
        {
            var bf = new BinaryFormatter();

            using (var ms = new MemoryStream())
            {
                bf.Serialize(ms, msg);
            }

            client.PushMessage(msg);

            if (replyHandler != null)
            {
                if (Default != null)
                {
                    Default.ipcQueue.AddMessage(msg, replyHandler, retryNum);
                }
                else
                {
                    ipcQueue.AddMessage(msg, replyHandler, retryNum);
                }
            }
        }
 public abstract void PushMessage(BaseMessage msg, ReplyHandlerClass replyHandler = null, int retryNum = 0);
 /// <summary>
 /// The un-typed inner class.
 /// </summary>
 public ReplyHandlerClass(ReplyHandlerClass inner) : base(inner.Communicator)
 {
 }