Asynchronous client

RCFProto support and general discussion.
Post Reply
masseman
Posts: 1
Joined: Tue Dec 03, 2013 12:24 pm

Asynchronous client

Post 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?

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Asynchronous client

Post 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());
        }
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

Post Reply