示例#1
0
 public ReconnectAttemptException(string message, BaseSocketConnectionCreator creator, Exception innerException, int attempt, bool maxReached)
     : base(message, innerException)
 {
     fAttempt = attempt;
     fMaxReached = maxReached;
     fCreator = creator;
 }
        public BaseSocketConnection(BaseSocketConnectionHost host, BaseSocketConnectionCreator creator, Socket socket)
        {
            Context = new SocketContext
            {
                ConnectionId = host.Context.GenerateConnectionId(),
                SyncData = new object(),
                Host = host,
                Creator = creator,
                SocketHandle = socket,
                SyncActive = new object(),
                Active = false,
                WriteQueue = new Queue<MessageBuffer>(),
                WriteQueueHasItems = false,
                SyncReadPending = new object(),
                ReadPending = false,
                SyncEventProcessing = new object(),
                EventProcessing = EventProcessing.epNone,
                LastAction = DateTime.Now,
            };

            FWriteOV = new SocketAsyncEventArgs();
            FReadOV = new SocketAsyncEventArgs();
        }
示例#3
0
        protected void RemoveCreator(BaseSocketConnectionCreator creator)
        {
            if (!Disposed)
            {
                lock (context.SocketCreators)
                {
                    context.SocketCreators.Remove(creator);

                    if (context.SocketCreators.Count <= 0)
                    {
                        fWaitCreatorsDisposing.Set();
                    }
                }
            }
        }
示例#4
0
        protected BaseSocketConnectionCreator[] GetSocketCreators()
        {
            BaseSocketConnectionCreator[] items = null;

            if (!Disposed)
            {
                lock (context.SocketCreators)
                {
                    items = new BaseSocketConnectionCreator[Context.SocketCreators.Count];
                    context.SocketCreators.CopyTo(items, 0);
                }
            }

            return items;
        }
示例#5
0
 protected void AddCreator(BaseSocketConnectionCreator creator)
 {
     if (!Disposed)
     {
         lock (Context.SocketCreators)
         {
             context.SocketCreators.Add(creator);
         }
     }
 }
 internal ClientSocketConnection(BaseSocketConnectionHost host, BaseSocketConnectionCreator creator, Socket socket)
     : base(host, creator, socket)
 {
 }
 public BaseSocketConnection(BaseSocketConnectionCreator creator, Socket socket)
     : this(creator.Context.Host, creator, socket)
 {
 }
 public ServerSocketConnection(BaseSocketConnectionHost host, BaseSocketConnectionCreator creator, Socket socket)
     : base(host, creator, socket)
 {
     //-----
 }