Ejemplo n.º 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;
                        }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void OnReloaded(DisquuunSocket reloadedSocket)
        {
            // consume stacked command if need.
            lock (poolLock)
            {
                if (disquuunDataStack.IsQueued())
                {
                    if (reloadedSocket.IsAvailable())
                    {
                        reloadedSocket.SetBusy();

                        var commandAndData = disquuunDataStack.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;
                        }
                        }
                    }
                }
            }
        }