Page 1 of 1

Asynchronous client

Posted: Tue Dec 03, 2013 12:33 pm
by masseman
Hello,

I can't get the asynchronous client mode to work in C++. The same call made synchronously works perfectly.

Stepping through the code, I see this in RcfProtoChannel::onCompletionCpp():

Code: Select all

  void RcfProtoChannel::onCompletionCpp()
  {
    Message * pResponse = mpResponse;
    Closure * pClosure = mpClosure;

    mpRequest = NULL;
    mpResponse = NULL;
    mpClosure = NULL;
and further down, when not synchronous mode:

Code: Select all

          if (mError.good() && mpResponse)
          {
              mpResponse->ParseFromArray(
                  mResponseBuffer.getPtr(),
                  (int) mResponseBuffer.getLength());
          }
If I understand correctly, mpResponse will always be NULL, since it was set at the beginning of the function, and the response buffer will never be parsed.

Or am I doing something wrong?

Re: Asynchronous client

Posted: Thu Dec 05, 2013 4:53 am
by jarl
That's definitely a mistake - thanks for spotting it! The second snippet should be:

Code: Select all

        if (mError.good() && pResponse)
        {
            pResponse->ParseFromArray(
                mResponseBuffer.getPtr(), 
                (int) mResponseBuffer.getLength());
        }