diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-10-01 14:41:43 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-10-01 14:41:43 +0100 |
commit | cd09b06adb30135f55909c02840c339422217d95 (patch) | |
tree | cdb3764ce7fe59df55c4fec68b4ab8dd667fec61 /agni.c | |
parent | 512f057166af84c11fc7ed5e4768b9dd2fe9f590 (diff) | |
download | agni-cd09b06adb30135f55909c02840c339422217d95.tar.gz agni-cd09b06adb30135f55909c02840c339422217d95.zip |
Fixed warnings all over the places
Diffstat (limited to 'agni.c')
-rw-r--r-- | agni.c | 46 |
1 files changed, 14 insertions, 32 deletions
@@ -288,12 +288,12 @@ int th_start_client(void *data) ENL(); } //PRINT("SERVER:%s PORT:%s USER:%s\n", cfg->server, cfg->port, cfg->user); - PRINT("out_attr.mq_msgsize %d\n", out_attr.mq_msgsize); + PRINT("out_attr.mq_msgsize %ld\n", out_attr.mq_msgsize); out_buf = malloc(out_attr.mq_msgsize); if (out_buf == NULL) { - ERROR("Can allocate out_buf, size of %d\n", out_attr.mq_msgsize); + ERROR("Can allocate out_buf, size of %ld\n", out_attr.mq_msgsize); } memset(out_buf, 0, out_attr.mq_msgsize); @@ -380,7 +380,7 @@ int th_start_client(void *data) user[sep-cmd->ircident] = 0x0; char *resp_user = token_new_str(cmd->tok, 2); //PRINT("resp_user %s\n",resp_user); - int formated_size = -1; + //int formated_size = -1; int count; sds str_out; @@ -556,6 +556,10 @@ int th_start_client(void *data) } req = rpc_req_new(qcmd->cmd, qcmd->param, qcmd->cid); + req->user = alloc_new_str("U-ser"); + req->mask = alloc_new_str("M-ask"); + req->server = alloc_new_str("S-erver"); + rpc_req_marsh(req, &nb_req); buf_nb = nb_create(nb_req); memcpy(out_buf, buf_nb, nb_req->size > out_attr.mq_msgsize ? out_attr.mq_msgsize : nb_req->size); @@ -769,31 +773,6 @@ int th_event_manager(void *data) run = 1; while(run) { - //check if there is some message and save it to buffer - /* - run += 1; - mq_event = mq_ntf_select(mq, MQ_OUT); - switch(mq_event) - { - case 0: - //PRINT("EVENT 0\n"); - break; - case 1: - PRINT("MQ_EVENT OUT\n"); - memset(out_buf, 0, out_attr.mq_msgsize); - if (mq_ntf_read(mq, MQ_OUT, out_buf, out_attr.mq_msgsize) == -1) - { - printf("Cant read output message\n"); - } else - { - out_buf[out_attr.mq_msgsize-1] = 0x0; - printf("Recieve %s\n", out_buf); - } - break; - default: - printf("Unknown event type\n"); - } - */ run += 1; for (i_mq=0;i_mq<cfg->mq_num;i_mq++) @@ -828,7 +807,7 @@ int th_event_manager(void *data) if (0 == nb_load(nb_req, out_buf)) { rpc_req_unmarsh(nb_req, &req); - PRINT("EVENT-REQ: %d-%s(%s)\n", req->id, req->method, req->params); + PRINT("EVENT-REQ: %d-%s(%s) %s-%s-%s\n", req->id, req->method, req->params, req->user, req->mask, req->server); //nb_print(nb_req); if (strncmp(req->method,":PRIVMSG",8)) @@ -850,21 +829,24 @@ int th_event_manager(void *data) FREE(stat_str); } - if (tbl_exec_run(etbl, exec_params, "", "", "", &ret_msg)>=0) + if (tbl_exec_run(etbl, exec_params, req->user, req->mask, req->server, &ret_msg)>=0) { if (ret_msg != NULL) { - printf("Ret message %s\n",ret_msg); + printf("Ret message %s\n",(char *)ret_msg); //send response resp = rpc_resp_new(ret_msg,"None",req->id); + resp->user = alloc_new_str(""); + resp->mask = alloc_new_str(""); + resp->server = alloc_new_str(""); rpc_resp_marsh(resp, &nb_resp); buf_nb = nb_create(nb_resp); mq_ntf_write(mq_cur, MQ_IN, buf_nb, nb_resp->size > in_attr.mq_msgsize ? in_attr.mq_msgsize : nb_resp->size); stats.cnt_ipc_tx += nb_resp->size > in_attr.mq_msgsize ? in_attr.mq_msgsize : nb_resp->size; FREE(buf_nb); - printf("EVENT-Write %d bytes\n", nb_resp->size > in_attr.mq_msgsize ? in_attr.mq_msgsize : nb_resp->size); + printf("EVENT-Write %ld bytes\n", nb_resp->size > in_attr.mq_msgsize ? in_attr.mq_msgsize : nb_resp->size); FREE(ret_msg); nb_free(nb_resp); |