Commit ef51919d authored by Matthieu Dorier's avatar Matthieu Dorier

corrected bug with async_response's reference to callable_remote_procedure

parent 50e6f7bc
......@@ -30,7 +30,7 @@ private:
margo_request m_request;
engine* m_engine;
callable_remote_procedure& m_rpc;
hg_handle_t m_handle;
buffer m_buffer;
bool m_ignore_response;
......@@ -43,11 +43,20 @@ private:
* @param c callable_remote_procedure that created the async_response.
* @param ignore_resp whether response should be ignored.
*/
async_response(margo_request req, engine& e, callable_remote_procedure& c, bool ignore_resp)
: m_request(req), m_engine(&e), m_rpc(c), m_ignore_response(ignore_resp) {}
async_response(margo_request req, engine& e, hg_handle_t handle, bool ignore_resp)
: m_request(req), m_engine(&e), m_handle(handle), m_ignore_response(ignore_resp) {
margo_ref_incr(handle);
}
public:
/**
* @brief Destructor.
*/
~async_response() {
margo_destroy(m_handle);
}
/**
* @brief Waits for the async_response to be ready and returns
* a packed_response when the response has been received.
......
......@@ -89,7 +89,7 @@ private:
ret = margo_provider_iforward(m_provider_id,
m_handle, const_cast<void*>(static_cast<const void*>(&buf)), &req);
MARGO_ASSERT(ret, margo_iforward);
return async_response(req, *m_engine, *this, m_ignore_response);
return async_response(req, *m_engine, m_handle, m_ignore_response);
}
public:
......
......@@ -14,9 +14,9 @@ packed_response async_response::wait() {
MARGO_ASSERT(ret, margo_wait);
buffer output;
if(m_ignore_response) return packed_response(std::move(output), *m_engine);
ret = margo_get_output(m_rpc.m_handle, &output);
ret = margo_get_output(m_handle, &output);
MARGO_ASSERT(ret, margo_get_output);
ret = margo_free_output(m_rpc.m_handle, &output); // won't do anything on a buffer type
ret = margo_free_output(m_handle, &output); // won't do anything on a buffer type
MARGO_ASSERT(ret, margo_free_output);
return packed_response(std::move(output), *m_engine);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment