Beispiel #1
0
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>The cloned instance.</returns>
        public override object Clone()
        {
            var clone = new DsrRouteErrorMessage()
            {
                NotReachableNode = this.NotReachableNode,
                FailedMessage    = (NetSimMessage)this.FailedMessage?.Clone()
            };

            if (this.Route != null)
            {
                clone.Route = new List <string>(this.Route);
            }

            return(this.CopyTo(clone));
        }
Beispiel #2
0
        private void IncomingDsrRouteErrorMessageHandler(NetSimMessage message)
        {
            DsrTable             dsrTable     = this.Table as DsrTable;
            DsrRouteErrorMessage errorMessage = (DsrRouteErrorMessage)message;

            // delete the (cached) routes defined by the error message from table
            dsrTable?.HandleError(errorMessage.Sender, errorMessage.NotReachableNode);

            // check if the respone is for this node
            if (errorMessage.Receiver.Equals(this.Client.Id))
            {
                // check if error has failed message
                if (errorMessage.FailedMessage != null)
                {
                    // try to retransmit the failed message - start route discovery again
                    this.SendMessage(errorMessage.FailedMessage);
                }
            }
            else
            {
                // forward message
                this.SendMessage(errorMessage);
            }
        }