Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unknown reply received: Please report a bug if you get this message #3

Open
taimooralam opened this issue Dec 2, 2016 · 1 comment

Comments

@taimooralam
Copy link

The Core::onReplyFinished(CoapReply *reply) finished method does not recognize one of the replies of a get request and instead executes the last else of the method. What might be the problem here?

} else if (reply == m_reply) { // the get request should execute this 
    //qDebug() << "------------------------------------------" << endl << reply;

    QString path = reply->request().url().path();

    QString payload = reply->payload();

} else { //but instead executes part

    qWarning() << "Unknown reply received: Please report a bug if you get this message";

}
@t-mon
Copy link
Owner

t-mon commented Dec 2, 2016

Hard to say without the whole code. You could try to use a lambda function like this (if you use at least c++11):

    CoapReply *reply = m_coap->get(CoapRequest(url));
    connect(reply, &CoapReply::finished, [reply]() {
        if (reply->error() != CoapReply::NoError) {
            qWarning() << "Could not get resource" << reply->request().url().toString() << ":" << reply->errorString();
            reply->deleteLater();
            return;
        }

        qDebug() << reply->payload();
        // Do something
        reply->deleteLater();
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants