Esempio n. 1
0
        /// <summary>
        /// Called when an <see cref="AdapterEndPoint"/> has been destroyed.
        /// </summary>
        /// <param name="endPoint">A reference to the destroyed endpoint.</param>
        protected virtual void OnEndPointDestroyed(AdapterEndPoint endPoint)
        {
            try
            {
                bool removed = false;

                lock (endPointCollection)
                    removed = endPointCollection.Remove(endPoint);

                if (removed)
                {
                    //Safely invoke the event handler
                    EventHandler <AdapterEndPointEventArgs> temp = EndPointDestroyed;

                    if (temp != null)
                    {
                        temp(this, new AdapterEndPointEventArgs(endPoint));
                    }
                }
            }
            catch (MessageEngineException ex)
            {
                if ((MessageEngine.Instance.Tracing.Switch.Level & SourceLevels.Error) == SourceLevels.Error)
                {
                    MessageEngine.Instance.Tracing.TraceData(TraceEventType.Error, 0, ex);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Called when a message is received by the adapter.
        /// </summary>
        /// <param name="msg">The message received.</param>
        /// <param name="endPoint">The <see cref="AdapterEndPoint"/> which the message was received from.</param>
        protected virtual void OnMessageReceived(MultiPartMessage msg, AdapterEndPoint endPoint)
        {
            try
            {
                //Safely invoke the event handler
                EventHandler <AdapterReceiveEventArgs> temp = MessageReceived;

                if (temp != null)
                {
                    temp(this, new AdapterReceiveEventArgs(msg, endPoint));
                }
            }
            catch (MessageEngineException ex)
            {
                if ((MessageEngine.Instance.Tracing.Switch.Level & SourceLevels.Error) == SourceLevels.Error)
                {
                    MessageEngine.Instance.Tracing.TraceData(TraceEventType.Error, 0, ex);
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     <para>Initializes an instance of the <see cref="AdapterEndPointEventArgs"/> class.</para>
 /// </summary>
 /// <param name="endPoint">
 /// The <see cref="AdapterEndPoint"/> participating in the event.
 /// </param>
 public AdapterEndPointEventArgs(AdapterEndPoint endPoint) : base()
 {
     this.endPoint = endPoint;
 }
 /// <summary>
 ///     <para>Initializes an instance of the <see cref="AdapterReceiveEventArgs"/> class.</para>
 /// </summary>
 /// <param name="msg">
 /// A reference to the received message.
 /// </param>
 /// <param name="receiveEndPoint">
 /// The <see cref="AdapterEndPoint"/> from which the message was received.
 /// </param>
 public AdapterReceiveEventArgs(MultiPartMessage msg, AdapterEndPoint receiveEndPoint) : base()
 {
     this.msg             = msg;
     this.receiveEndPoint = receiveEndPoint;
 }