|
@@ -143,6 +143,11 @@ int (*res_cb)(json_object*, char*, int) = &result_cb;
|
|
void cmd_pipe_cb(int fd, short event, void *arg)
|
|
void cmd_pipe_cb(int fd, short event, void *arg)
|
|
{
|
|
{
|
|
struct jsonrpc_pipe_cmd *cmd;
|
|
struct jsonrpc_pipe_cmd *cmd;
|
|
|
|
+ char *ns = 0;
|
|
|
|
+ size_t bytes;
|
|
|
|
+ json_object *payload = NULL;
|
|
|
|
+ jsonrpc_request_t *req = NULL;
|
|
|
|
+ json_object *params;
|
|
/* struct event *ev = (struct event*)arg; */
|
|
/* struct event *ev = (struct event*)arg; */
|
|
|
|
|
|
if (read(fd, &cmd, sizeof(cmd)) != sizeof(cmd)) {
|
|
if (read(fd, &cmd, sizeof(cmd)) != sizeof(cmd)) {
|
|
@@ -150,9 +155,7 @@ void cmd_pipe_cb(int fd, short event, void *arg)
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- json_object *params = json_tokener_parse(cmd->params);
|
|
|
|
- json_object *payload = NULL;
|
|
|
|
- jsonrpc_request_t *req = NULL;
|
|
|
|
|
|
+ params = json_tokener_parse(cmd->params);
|
|
|
|
|
|
if (cmd->notify_only) {
|
|
if (cmd->notify_only) {
|
|
payload = build_jsonrpc_notification(cmd->method, params);
|
|
payload = build_jsonrpc_notification(cmd->method, params);
|
|
@@ -168,7 +171,6 @@ void cmd_pipe_cb(int fd, short event, void *arg)
|
|
}
|
|
}
|
|
char *json = (char*)json_object_get_string(payload);
|
|
char *json = (char*)json_object_get_string(payload);
|
|
|
|
|
|
- char *ns; size_t bytes;
|
|
|
|
bytes = netstring_encode_new(&ns, json, (size_t)strlen(json));
|
|
bytes = netstring_encode_new(&ns, json, (size_t)strlen(json));
|
|
|
|
|
|
struct jsonrpc_server_group *g;
|
|
struct jsonrpc_server_group *g;
|
|
@@ -239,7 +241,11 @@ void cmd_pipe_cb(int fd, short event, void *arg)
|
|
pkg_free(ns);
|
|
pkg_free(ns);
|
|
json_object_put(payload);
|
|
json_object_put(payload);
|
|
if (cmd->notify_only) free_pipe_cmd(cmd);
|
|
if (cmd->notify_only) free_pipe_cmd(cmd);
|
|
|
|
+ return;
|
|
|
|
+
|
|
error:
|
|
error:
|
|
|
|
+ if(ns) pkg_free(ns);
|
|
|
|
+ if(payload) json_object_put(payload);
|
|
if (cmd->notify_only) free_pipe_cmd(cmd);
|
|
if (cmd->notify_only) free_pipe_cmd(cmd);
|
|
return;
|
|
return;
|
|
}
|
|
}
|