Пример #1
0
        public void OnReloaded(DisquuunSocket reloadedSocket)
        {
            lock (lockObject)
            {
                if (stackSocket.IsQueued())
                {
                    if (reloadedSocket.IsChoosable())
                    {
                        reloadedSocket.SetBusy();

                        var commandAndData = stackSocket.Dequeue();
                        switch (commandAndData.executeType)
                        {
                        case DisquuunExecuteType.ASYNC:
                        {
                            reloadedSocket.Async(commandAndData.commands, commandAndData.data, commandAndData.Callback);
                            return;
                        }

                        case DisquuunExecuteType.LOOP:
                        {
                            reloadedSocket.Loop(commandAndData.commands, commandAndData.data, commandAndData.Callback);
                            return;
                        }

                        case DisquuunExecuteType.PIPELINE:
                        {
                            reloadedSocket.Execute(commandAndData.commands, commandAndData.data, commandAndData.Callback);
                            return;
                        }
                        }
                    }
                }
            }
        }
Пример #2
0
 private void OnSocketConnectionFailed(DisquuunSocket source, string info, Exception e)
 {
     UpdateState();
     if (ConnectionFailed != null)
     {
         ConnectionFailed("OnSocketConnectionFailed:" + info, e);
     }
 }
Пример #3
0
        private void OnSocketOpened(DisquuunSocket source, string socketId)
        {
            if (connectionState != ConnectionState.OPENING)
            {
                return;
            }
            var availableSocketCount = socketPool.AvailableSocketNum();

            lock (lockObject)
            {
                if (connectionState != ConnectionState.OPENED && availableSocketCount == minConnectionCount)
                {
                    connectionState = ConnectionState.OPENED;
                    ConnectionOpened(connectionId);
                }
            }
        }