Ejemplo n.º 1
0
        private void HandleTransactionData(IAsyncResult ar)
        {
            var state = (StateObject)ar.AsyncState;

            try
            {
                using (var scope = _serviceProvider.CreateScope())
                {
                    Transaction transaction = state.Transaction;

                    transaction.Id       = 0;
                    transaction.Input.Id = 0;
                    transaction.Outputs.ForEach(o => o.Id = 0);

                    _transactionPoolService = scope.ServiceProvider.GetService <TransactionPoolService>();
                    _transactionPoolService.UpdateOrAddTransaction(transaction);

                    Console.WriteLine("Received Transaction : ");
                    Console.WriteLine(Encoding.UTF8.GetString(state.buffer));
                }
            }
            finally
            {
                messageManualReset.Set();
                state.workSocket.EndReceive(ar);
            }
        }
Ejemplo n.º 2
0
        private void HandleTransactionData(IAsyncResult ar)
        {
            var state = (StateObject)ar.AsyncState;

            try
            {
                Transaction transaction = state.Transaction;

                _transactionPoolService = _serviceProvider.GetService <TransactionPoolService>();
                _transactionPoolService.UpdateOrAddTransaction(transaction);

                Console.WriteLine("Received Transaction : ");
                Console.WriteLine(Encoding.UTF8.GetString(state.buffer));
            }
            finally
            {
                messageManualReset.Set();
                state.workSocket.EndReceive(ar);
            }
        }