Esempio n. 1
0
    public HttpLoader(HttpRequest.Handler dataHandler      = null
                      , HttpRequest.Handler errorHandler   = null
                      , HttpRequest.Handler timeoutHandler = null
                      , int nMaxParallelRequest            = 3
                      , float pollInterval = 0.2f)
    {
        _nMaxParallelRequest = nMaxParallelRequest;

        DataHandler    = _dataHandler;
        ErrorHandler   = _errorHandler;
        TimeoutHandler = _timeoutHandler;

        if (dataHandler != null)
        {
            DataHandler = dataHandler;
        }
        if (errorHandler != null)
        {
            ErrorHandler = errorHandler;
        }
        if (timeoutHandler != null)
        {
            TimeoutHandler = timeoutHandler;
        }

        _aliveRequests = new HashSet <HttpRequest>();
        _timer         = TimerMgr.REPEAT(MathEx.INFINITE, pollInterval, _onPollRequest);

        _queuedRequests = new LinkedList <HttpRequest>();

        __deadList           = new QuickList <HttpRequest>();
        __nAliveRequestCount = 0;
    }