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
dispatcher: add attrs param to rpc 'add' call #2336
Conversation
Thanks, it looks good to me. I think it can be merged. |
Thanks Henning. |
|
||
flags = 0; | ||
|
||
if(rpc->scan(ctx, "dS*d", &group, &dest, &flags) < 2) { | ||
if(rpc->scan(ctx, "dS*d", &group, &dest, &flags, &attrs) < 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here is missing and extra S
in scan's 2nd parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above condition needs some update. Because attrs is optional, then it is still fine to go on with return code 2 (which represents the number of items/params scanned).
Probably return code has to be stored in a variable, e.g., then if ret<2 is error, if ret==2 then attrs.s=NULL and attrs.len=0 (or attrs=STR_NULL when declared).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'm going to fix.
@@ -1800,15 +1800,16 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx) | |||
{ | |||
int group, flags; | |||
str dest; | |||
str attrs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix also the indentation here, since the S
needs to be added below.
Pre-Submission Checklist
in
doc/
subfolder, the README file is autogenerated)Type Of Change
Checklist:
Description
Expands the rpc 'add' command allowing to specify the "attrs" body.