Exemple #1
0
        public IEnumerator UF_AsyncGetResp(HttpWebRequest Request)
        {
            UF_DebugLog("begin Get Response");
            this.m_Response          = null;
            this.m_isWaitingResponse = true;
            AsyncStruct asyncstruct = new AsyncStruct();

            asyncstruct.downloader = this;
            asyncstruct.request    = Request;
            Request.BeginGetResponse(new AsyncCallback(UF_CallBack_Resp), asyncstruct);
            for (int i = 0; i < 20 && m_isWaitingResponse; i++)
            {
                UF_DebugLog("checking " + m_isWaitingResponse + " : " + i);
                //check every 0.5 seconds
                yield return(new WaitForSeconds(0.5f));

                if (m_Response != null)
                {
                    UF_DebugLog("Get Response success");
                    break;
                }
            }
            m_isWaitingResponse = false;
            if (m_Response == null && m_RetCode == 0)
            {
                m_RetCode = 401;
                m_ErrMsg  = "Wait Response Time Out";
            }
        }
Exemple #2
0
 public void AddPacFromClient(AsyncStruct asy)
 {
     lock (que)
     {
         que.Enqueue(asy);
     }
 }
Exemple #3
0
 private void Update()
 {
     if (que.Count == 0)
     {
         return;
     }
     lock (que)
     {
         AsyncStruct asy = que.Dequeue();
         asy.action(asy.state);
     }
 }
Exemple #4
0
 private AsyncRewriter2(
     BoundStatement body,
     MethodSymbol method,
     AsyncStruct stateMachineClass,
     TypeCompilationState compilationState,
     DiagnosticBag diagnostics,
     bool generateDebugInfo)
     : base(body, method, stateMachineClass, compilationState, diagnostics, generateDebugInfo)
 {
     try
     {
         constructedSuccessfully = AsyncMethodBuilderMemberCollection.TryCreate(F, method, this.stateMachineClass.TypeMap, out this.asyncMethodBuilderMemberCollection);
     }
     catch (SyntheticBoundNodeFactory.MissingPredefinedMember ex)
     {
         diagnostics.Add(ex.Diagnostic);
         constructedSuccessfully = false;
     }
 }
Exemple #5
0
 private AsyncRewriter2(
     BoundStatement body,
     MethodSymbol method,
     AsyncStruct stateMachineClass,
     TypeCompilationState compilationState,
     DiagnosticBag diagnostics,
     bool generateDebugInfo)
     : base(body, method, stateMachineClass, compilationState, diagnostics, generateDebugInfo)
 {
     try
     {
         constructedSuccessfully = AsyncMethodBuilderMemberCollection.TryCreate(F, method, this.stateMachineClass.TypeMap, out this.asyncMethodBuilderMemberCollection);
     }
     catch (SyntheticBoundNodeFactory.MissingPredefinedMember ex)
     {
         diagnostics.Add(ex.Diagnostic);
         constructedSuccessfully = false;
     }
 }