Esempio n. 1
0
    virtual void setAsyncResult(const BVariant& result) {
      bool relogin = false;

      try {
        if (result.isException()) {
          relogin = internalIsReloginException(result.getException());
          if (!relogin) {
            innerResult->setAsyncResult(BVariant(result.getException()));
          }
        }
        else {
          try {
            POBJECT obj;
            result.get(obj);
            if (obj) {
              PMessage msg = byps_static_ptr_cast<BMessage>(obj);

              PInput inp = transport->getInput(msg->header, msg->buf);
              PSerializable sobj = inp->load();
              innerResult->setAsyncResult(BVariant(sobj));
            }
            else {
              BException ex(BExceptionC::CORRUPT, L"Missing message object in result.");
              innerResult->setAsyncResult(BVariant(ex));
            }
          }
          catch (const BException& e) {
            relogin = internalIsReloginException(e);
            if (!relogin) {
              innerResult->setAsyncResult(BVariant(e));
            }
          }
        }

        if (relogin) {
          transport->loginAndRetrySend(requestObject, innerResult);
        }
      }
      catch (const exception& ex) {
        innerResult->setAsyncResult(BVariant(ex));
      }

      delete this;
    }
Esempio n. 2
0
    virtual void setAsyncResult(const BVariant& var) {
      try {
        if (var.isException()) {
          outp->setException(var.getException());
        }
        else {
          PSerializable obj;
          var.get(obj);
          outp->store(obj);
        }
        PMessage msg = outp->toMessage();

        innerResult->setAsyncResult(BVariant(msg));
      }
      catch (const exception& ex) {
        innerResult->setAsyncResult(BVariant(ex));
      }
      delete this;
    }
Esempio n. 3
0
    virtual void setAsyncResult(const BVariant& result) {

      BException ex = result.getException();
      std::vector<PAsyncResult> copyResults;

      {
        byps_unique_lock lock(transport->mtx);
        copyResults = transport->asyncResultsWaitingForAuthentication;
        transport->asyncResultsWaitingForAuthentication.clear();
        transport->lastAuthenticationTime = system_clock::now();
        transport->lastAuthenticationException = ex;
      }

      transport->negotiateActive = false;

      for (size_t i = 0; i < copyResults.size(); i++)
      {
        copyResults[i]->setAsyncResult(result);
      }

      delete this;
    }