Example #1
0
        //
        // Defer handing of messages until the function h is called (periodically)
        // and returns TRUE.  At that point handling is reenabled.
        // If stalling was not already enabled and there are no other problems,
        // then we return TRUE, otherwise FALSE.
        // Use isPacketHandlingStalled() to determine if handling is currently
        // stalled.
        //
        public bool stallPacketHandling(StallingHandler h, Object data)
        {
            if (isPacketHandlingStalled())
                return false;

            deferPacketHandling = true;

            stallingWorker = h;
            stallingWorkerData = data;

            return true;
        }
Example #2
0
        public PacketIF(String server, int port, bool local, bool asClient)
        {
            Debug.Assert(server != null);

            wpClientData = this;
            workProcInstalled = false;

            socket = null;
            error = false;
            deferPacketHandling = false;
            deleting = false;
            packetSender = false;

            line = "";

            echoCallback = null;
            echoClientData = null;
            endReceiving = true;

            linkHandler = null;
            stallingWorker = null;
            stallingWorkerData = null;

            if (asClient)
                connectAsClient(server, port, local);
            else
                connectAsServer(port);

            output_queue = new List<QueuedBytes>();

            if (!error)
            {
                installInputHandler();
            }
        }
Example #3
0
        public bool InputIdleWP()
        {
            if (isPacketHandlingStalled())
            {
                Debug.Assert(stallingWorker != null);
                Debug.Assert(deferPacketHandling);
                if (stallingWorker(stallingWorkerData))
                {
                    stallingWorker = null;
                    deferPacketHandling = false;
                    packetReceive(false);
                }
            }
            else
                deferPacketHandling = false;

            PacketIF pif = DXApplication.theDXApplication.getPacketIF();
            if (pif.output_queue.Count != 0)
                pif.QueuedPacketWP();

            return (!deferPacketHandling);
        }