Exemple #1
0
        private static void SocketOnOnDataReceived(object sender, MessageEventArgs e)
        {
            ExecutedInfo info     = null;
            var          executed = false;
            int?         id       = null;

            try
            {
                if (e.IsText)
                {
                    info = ProcessData(e.Data, out executed, out id);
                }

                if (executed)
                {
                    SendExecuted(info, id);
                }
            }
            catch (RpcException rEr)
            {
                NHM.Common.Logger.Error("SOCKET", rEr.Message);
                if (!executed)
                {
                    return;
                }
                NHM.Common.Logger.Error("SOCKET", $"Sending executed response with code {rEr.Code}");
                SendExecuted(info, id, rEr.Code, rEr.Message);
            }
            catch (Exception er)
            {
                NHM.Common.Logger.Error("SOCKET", er.Message);
            }
        }
        public override void OnExecuted(ExecutedInfo executedInfo)
        {
            if (executedInfo.Source != ReturnedValueSources.OriginalMethod)
            {
                return;
            }
            string key = this.GetKeyWithArguments(executedInfo.Method, executedInfo.Arguments);

            this.CachePool.Set(key, executedInfo.ReturnedValue);
        }
Exemple #3
0
        public override void OnExecuted(ExecutedInfo executedInfo)
        {
            string cacheKey = this.GetKeyWithArguments(executedInfo.Method, executedInfo.Arguments);

            this.CachePool.Clean(cacheKey);
            var keysWillBeMoved = this.CacheRelationshipManager.GetCacheKeysWillBeRemovedWith(cacheKey);

            foreach (var item in keysWillBeMoved)
            {
                this.CachePool.Clean(item);
            }
        }
Exemple #4
0
        private static void SendExecuted(ExecutedInfo info, int?id, int code = 0, string message = null)
        {
            // First set status
            SendMinerStatus(false);
            // Then executed
            var data = new ExecutedCall(id ?? -1, code, message).Serialize();

            _socket?.SendData(data);
            // Login if we have to
            if (info?.LoginNeeded ?? false)
            {
                _socket?.StartConnection(info.NewBtc, info.NewWorker, info.NewRig);
            }
        }
Exemple #5
0
 private static void SendExecuted(ExecutedInfo info, int?id, int code = 0, string message = null)
 {
     IsRPC = true;
     try
     {
         // First set status
         NHM.Common.Logger.Debug("SOCKET", "SendExecuted-SendMinerStatus(false);");
         //SendMinerStatus(false); // THIS LINE HERE IS PROBLEMATIC BECAUSE IT DOESN'T WAIT FOR TASK COMPLETION
         while (SendMinerStatusTasks.TryDequeue(out var t))
         {
             CancelNotifyStateChangedTask();
             try
             {
                 //NHM.Common.Logger.Info("DEBUGDELSOCKET", "SendExecuted-WAIT-START");
                 t.Wait();
                 //NHM.Common.Logger.Info("DEBUGDELSOCKET", "SendExecuted-WAIT-END");
             }
             catch
             {
                 //NHM.Common.Logger.Info("DEBUGDELSOCKET", "SendExecuted-WAIT-EXCEPTION");
             }
         }
         SendMinerStatus(false);
         // Then executed
         var data = new ExecutedCall(id ?? -1, code, message).Serialize();
         _socket?.SendData(data);
         // Login if we have to
         if (info?.LoginNeeded ?? false)
         {
             _socket?.StartConnection(info.NewBtc, info.NewWorker, info.NewRig);
         }
     }
     finally
     {
         IsRPC = false;
     }
 }
Exemple #6
0
 public void OnExecuted(ExecutedInfo executedInfo)
 {
 }
Exemple #7
0
 public override void OnExecuted(ExecutedInfo executedInfo)
 {
     this.DbConnectionContextProvider.Provide().CommitTran();
 }
        public override void OnExecuted(ExecutedInfo executedInfo)
        {
            User user = (User)executedInfo.ReturnedValue;

            user.Id = Guid.NewGuid();
        }
Exemple #9
0
 public override void OnExecuted(ExecutedInfo executedInfo)
 {
 }
 public void OnExecuted(ExecutedInfo executedInfo)
 {
     logger.Info($"Executed : {executedInfo.ReturnedValue}");
 }
 public override void OnExecuted(ExecutedInfo executedInfo)
 {
     this.eventBus.Publish(new SendMessageEvent(this, "A2"));
 }
 public virtual void OnExecuted(ExecutedInfo executedInfo)
 {
 }