Exemple #1
0
        protected virtual void OnSend(SendEventArgs <T> e)
        {
            var handler = this.Send;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemple #2
0
        internal bool SendMessage(T msg, IConnection connection)
        {
            var e = new SendingEventArgs <T>(msg);

            this.OnSending(e);
            if (!e.Cancelled)
            {
                var e2 = new SendEventArgs <T>(msg);
                this.OnSend(e2);

                e.Message.Send(connection);

                return(true);
            }
            return(false);
        }
Exemple #3
0
        private void OnSendPlace(object sender, SendEventArgs <PlaceSendMessage> e)
        {
            var b = e.Message;
            var p = b.GetPoint3D();

            lock (this._sentBlocks)
            {
                this._timeoutResetEvent.Set();
                this._finishResetEvent.Reset();

                var         overwrritenSends = 0;
                CheckHandle oldHandle;
                if (this._sentLocations.TryGetValue(p, out oldHandle))
                {
                    this._sentBlocks.Remove(oldHandle);
                    overwrritenSends = oldHandle.OverwrittenSends + 1;
                }

                var newHandle = new CheckHandle(b, overwrritenSends);
                this._sentBlocks.AddToBack(newHandle);
                this._sentLocations[p] = newHandle;
            }
        }