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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1800,15 +1800,16 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx) | |
{ | ||
int group, flags; | ||
str dest; | ||
str attrs; | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. I think here is missing and extra There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Right, I'm going to fix. |
||
rpc->fault(ctx, 500, "Invalid Parameters"); | ||
return; | ||
} | ||
|
||
if(ds_add_dst(group, &dest, flags) != 0) { | ||
if(ds_add_dst(group, &dest, flags, &attrs) != 0) { | ||
rpc->fault(ctx, 500, "Adding dispatcher dst failed"); | ||
return; | ||
} | ||
|
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.