Esempio n. 1
0
    virtual void setAsyncResult(const BVariant& result) {
      try {
        if (result.isException()) {
          innerResult->setAsyncResult(result);
        }
        else {
          POBJECT obj;
          result.get(obj);
          PMessage msg = byps_static_ptr_cast<BMessage>(obj);

          BNegotiate nego;
          nego.read(msg->buf);
          {
            byps_unique_lock lock(transport->mtx);
            transport->protocol = transport->createNegotiatedProtocol(nego);
            transport->targetId = nego.targetId;
            transport->connectedServerId = nego.targetId.getServerId();
            transport->sessionId = nego.sessionId;
          }

          transport->internalAuthenticate(innerResult);
        }
      }
      catch (const exception& ex) {
        innerResult->setAsyncResult(BVariant(ex));
      }
      delete this;
    }
Esempio n. 2
0
 virtual void setAsyncResult(const BVariant& result) {
   if (result.isException()) {
     asyncResult->setAsyncResult(result);
   }
   else {
     PMethodRequest methodRequest = byps_ptr_cast<BMethodRequest>(requestObject);
     if (methodRequest) {
       PSerializable session;
       result.get(session);
       methodRequest->setSession(session);
     }
     pTransport->send(methodRequest, asyncResult);
   }
   delete this;
 }
Esempio n. 3
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. 4
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;
    }