summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-03-08 23:34:01 +0000
committerFreeArtMan <dos21h@gmail.com>2017-03-08 23:34:01 +0000
commit85c7b6ed10cbeb3fbcb301dff6ab58e0398bde68 (patch)
tree83f8ba007b9d238fa6709524f5e32842eecde381
parente87adc6cbcbe3ec74a4d2c07aca944c7af122910 (diff)
downloadagni-85c7b6ed10cbeb3fbcb301dff6ab58e0398bde68.tar.gz
agni-85c7b6ed10cbeb3fbcb301dff6ab58e0398bde68.zip
Code cleanup
-rw-r--r--agni.c50
1 files changed, 3 insertions, 47 deletions
diff --git a/agni.c b/agni.c
index d405396..bb9dd40 100644
--- a/agni.c
+++ b/agni.c
@@ -458,12 +458,6 @@ int th_start_client(void *data)
recv_cmd = mq_cmd_creates(in_buf, in_attr.mq_msgsize, -1);
if (recv_cmd != NULL)
{
- //char *bufPtr = mq_cmd_buf(recv_cmd);
- //printf("Recieved response [%s]\n",bufPtr);
- //char *cmdPtr;
- //size_t cmdSz;
- //mq_cmd_cmd(recv_cmd, &cmdPtr, &cmdSz);
- //printf("CMD %s %d\n", cmdPtr, cmdSz);
if (mq_cmd_o_cmp_cmd(recv_cmd,"QUIT") == 0)
{
printf("QUIT recieved lets quit main loop\n");
@@ -515,9 +509,7 @@ int th_start_client(void *data)
if (token_cmp(itok,1,"NOTICE")==1)
{
- //int fret;
- //fret = write(conn,"NOTICE",strlen("NOTICE"));
- //printf("OUT<<Send %d\n",fret);
+
}
if (token_cmp(itok,1,"PING")==1)
{
@@ -545,11 +537,9 @@ int th_start_client(void *data)
fret = write(conn,cmd_buf,fret2);
//create command and send to mq
- PRINT("msg %s\n");
mq_cmd *privcmd = mq_cmd_create(1,"PRIVMSG",strlen("PRIVMSG"),msg,strlen(msg));
char *bufPtr;
bufPtr = mq_cmd_buf(privcmd);
- PRINT("BUF %s", bufPtr);
mq_ntf_write(mq, MQ_OUT, bufPtr, strlen(bufPtr));
mq_cmd_free(privcmd);
@@ -632,14 +622,12 @@ int th_event_manager(void *data)
if (etbl == NULL)
{
PERM();
- //return -1;
}
ecmd = tbl_exec_c();
if (ecmd == NULL)
{
PERM();
- //return -1;
}
ecmd->id = uniq_id();
ecmd->name = alloc_new_str("local-executor");
@@ -649,14 +637,12 @@ int th_event_manager(void *data)
if (-1 == tbl_exec_add(etbl, ecmd))
{
PERM();
- //return -1;
}
ecmd = tbl_exec_c();
if (ecmd == NULL)
{
PERM();
- //return -1;
}
ecmd->id = uniq_id();
ecmd->name = alloc_new_str("local-executor");
@@ -666,14 +652,12 @@ int th_event_manager(void *data)
if (-1 == tbl_exec_add(etbl, ecmd))
{
PERM();
- //return -1;
}
ecmd = tbl_exec_c();
if (ecmd == NULL)
{
PERM();
- //return -1;
}
ecmd->id = uniq_id();
ecmd->name = alloc_new_str("local-executor");
@@ -683,7 +667,6 @@ int th_event_manager(void *data)
if (-1 == tbl_exec_add(etbl, ecmd))
{
PERM();
- //return -1;
}
tbl_exec_print_tbl(etbl, TBL_PF_EXEC_ALL);
@@ -691,8 +674,7 @@ int th_event_manager(void *data)
if (etbl == NULL)
{
PERM();
- //return -1;
- }//PNL();
+ }
//create command table
qtbl = tbl_qcmd_c(10);//well 10 should be ok right?
@@ -714,7 +696,6 @@ int th_event_manager(void *data)
run = 1;
while(run)
{
- //PNL();
//check if there is some message and save it to buffer
run += 1;
mq_event = mq_ntf_select(mq, MQ_OUT);
@@ -737,11 +718,7 @@ int th_event_manager(void *data)
default:
printf("Unknown event type\n");
}
- //sleep(1);
- //if (run == 10)
- // break;
- //PNL();
//if QUIT then quit the thread
if (mq_event == 1)
{
@@ -764,27 +741,11 @@ int th_event_manager(void *data)
//create command and send to mq
char msg[] = "PONG";
mq_cmd *privcmd = mq_cmd_create(1,"PRIVMSG",strlen("PRIVMSG"),msg,strlen(msg));
-
- //char *str_mq = mq_cmd_buf(privcmd);
- //mq_ntf_write(mq, MQ_IN, str_mq, strlen(str_mq));
-
+
mq_cmd_free(privcmd);
} else if (mq_cmd_o_cmp_cmd(recv_cmd,"PRIVMSG") == 0)
{
printf("Some private message\n");
- /*char msg[] = "PONG EVENT THREAD";
-
- mq_cmd *privcmd = mq_cmd_create(1,"PRIVMSG",strlen("PRIVMSG"),msg,strlen(msg));
-
- //recieve params and match command to them
- char *paramPtr=NULL;
- size_t paramSz=0;
- mq_cmd_param(recv_cmd, &paramPtr, &paramSz);
- PRINT("param = %s\n",paramPtr);
- mq_ntf_write(mq, MQ_IN, paramPtr, paramSz);
-
- mq_cmd_free(privcmd);
- */
if (mq_cmd_o_cmp_param(recv_cmd, ":DATE") == 0)
{
char msg[] = "No date";
@@ -813,11 +774,6 @@ int th_event_manager(void *data)
mq_cmd *privcmd = mq_cmd_create(1,"PRIVMSG",strlen("PRIVMSG"),msg,strlen(msg));
- //recieve params and match command to them
- //char *paramPtr=NULL;
- //size_t paramSz=0;
- //mq_cmd_param(recv_cmd, &paramPtr, &paramSz);
- //PRINT("param = %s\n",paramPtr);
char *cmdBuf = mq_cmd_buf(privcmd);
mq_ntf_write(mq, MQ_IN, cmdBuf, strlen(cmdBuf));