Exemplo n.º 1
0
        internal void OnSocket_Accepted()
        {
            try
            {
                if (Activated != null)
                {
                    Activated(this);
                }

                SpinWorker.Dispatch(() =>
                {
                    lock (this)
                    {
                        if (NetworkEvent_Accepted != null)
                        {
                            NetworkEvent_Accepted(this);
                        }

                        _method.WaitForReceive();
                    }
                });
            }
            catch (Exception e)
            {
                Logger.Write(LogType.Err, 1, e.ToString());
            }
        }
Exemplo n.º 2
0
        internal void OnSocket_Accepted()
        {
            if (PacketValidator == null)
            {
                throw new AegisException(AegisResult.InvalidArgument, "PacketValidator is not set.");
            }

            try
            {
                Activated?.Invoke(this);

                SpinWorker.Dispatch(() =>
                {
                    lock (this)
                    {
                        EventAccept?.Invoke(new IOEventResult(this, IOEventType.Accept, AegisResult.Ok));

                        _method.WaitForReceive();
                    }
                });
            }
            catch (Exception e)
            {
                Logger.Err(LogMask.Aegis, e.ToString());
            }
        }