mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Allow epee async call response values to be moved
This allows the caller to also take the response by rvalue reference so that they can move outsubvalues. The rvalue is totally fine here (once the callback is invoked it is never used again) and still binds perfectly well to const-lvalue accepting callbacks.
This commit is contained in:
parent
cf4d44fb10
commit
29be7f6552
|
@ -120,23 +120,23 @@ namespace epee
|
|||
if( code <=0 )
|
||||
{
|
||||
LOG_PRINT_L1("Failed to invoke command " << command << " return code " << code);
|
||||
cb(code, result_struct, context);
|
||||
cb(code, std::move(result_struct), context);
|
||||
return false;
|
||||
}
|
||||
serialization::portable_storage stg_ret;
|
||||
if(!stg_ret.load_from_binary(buff))
|
||||
{
|
||||
LOG_ERROR("Failed to load_from_binary on command " << command);
|
||||
cb(LEVIN_ERROR_FORMAT, result_struct, context);
|
||||
cb(LEVIN_ERROR_FORMAT, std::move(result_struct), context);
|
||||
return false;
|
||||
}
|
||||
if (!result_struct.load(stg_ret))
|
||||
{
|
||||
LOG_ERROR("Failed to load result struct on command " << command);
|
||||
cb(LEVIN_ERROR_FORMAT, result_struct, context);
|
||||
cb(LEVIN_ERROR_FORMAT, std::move(result_struct), context);
|
||||
return false;
|
||||
}
|
||||
cb(code, result_struct, context);
|
||||
cb(code, std::move(result_struct), context);
|
||||
return true;
|
||||
}, inv_timeout);
|
||||
if( res <=0 )
|
||||
|
|
Loading…
Reference in a new issue