BitMaker.Miner.Pool.GetWorkLp C# (CSharp) Method

GetWorkLp() private method

Initiates a long-poll request for work.
private GetWorkLp ( IMiner miner, string comment ) : BitMaker.Miner.Work
miner IMiner
comment string
return BitMaker.Miner.Work
        Work GetWorkLp(IMiner miner, string comment)
        {
            var req = OpenLp(miner, comment);
            if (req == null)
                return null;

            var asy = req.BeginGetResponse(null, null);

            // wait until we're told to shutdown, or we run out of time
            var elapsed = 0;
            while (run && elapsed < TimeSpan.FromSeconds(60).TotalMilliseconds)
            {
                asy.AsyncWaitHandle.WaitOne(1000);
                elapsed += 1000;
            }

            if (!asy.IsCompleted)
            {
                // if it never completed, abort it
                req.Abort();
                return null;
            }
            else
                // otherwise parse the result
                return ParseGetWork(req.EndGetResponse(asy));
        }