internal ClientMailBox(IEntity receiver, ClientPostOffice office)
        {
            if (receiver.EntityName == null)
            {
                throw new Exception($"the '{nameof(receiver.EntityName)}' of receiver should not be null!");
            }

            this.receiver   = receiver;
            this.EntityName = receiver.EntityName;
            this.postoffice = office;
        }
Beispiel #2
0
        public override void Destroy()
        {
            this.Logout();

            base.Destroy();
            Phase = ConnectionPhase.P0Start;
            ClientAgentEvent?.Invoke(this,
                                     new ClientAgentEventArgs(ClientAgentEventType.Disconnected | ClientAgentEventType.Prompt, $"{this} was destroyed."));

            transPool.Destroy();
            transPool       = null;
            this.postOffice = null;
            logger.Debug("transaction pool destroyed.");
        }
Beispiel #3
0
        public ClientAgent(ClientPostOffice postOffice, string serverIpOrUrl, int port)
        {
            TeleClientName = "";
            EndPoint       = new DnsEndPoint(serverIpOrUrl, port);

            this.nowBlock = new TimeBlock();

            this.postOffice = postOffice;

            this.transPool = new TransactionPool();
            this.transPool.Register(Transaction_ConnectionMonitor, 10, "ConnectionMonitor");
            this.transPool.TransactionErrorEvent += (object sender, TransactionErrorArgs args) =>
            {
                throw new Exception($"transaction [{args.transaction.Name}]: {args.exception.Message}");
            };
        }
 internal void Destroy()
 {
     receiver   = null;
     postoffice = null;
 }