diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-05-16 23:05:24 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-05-16 23:05:24 +0100 |
commit | b891a3c3793412bad5ae74122ece655fbee06e5d (patch) | |
tree | f7742f5aa764209cddece218b59a61fb550bd133 | |
parent | b385fc9a6832f4186f98cde4bd92b7de6ac553b9 (diff) | |
download | agni-b891a3c3793412bad5ae74122ece655fbee06e5d.tar.gz agni-b891a3c3793412bad5ae74122ece655fbee06e5d.zip |
Remove debug prints
-rw-r--r-- | agni.c | 43 | ||||
-rw-r--r-- | sock_conn.c | 4 |
2 files changed, 14 insertions, 33 deletions
@@ -534,11 +534,8 @@ int th_start_client(void *data) qcmd = NULL; } - free(msg); free(uname); - //printf("OUT<<Send %d\n", fret); - } token_destroy(itok); itok = NULL; @@ -555,36 +552,25 @@ int th_start_client(void *data) } } else if (cret == 0) { - //int err_read_conn = errno; - //if ((err_read_conn == EBADF)||(err_read_conn == 11)) + //TODO add lofic to retry number, and thex exit from thread + //hope server where disconnected + + if (irc_reconnect(&conn)==-1) { - //TODO add lofic to retry number, and thex exit from thread - PRINT(">>!READ %d<<\n", cret); - //hope server where disconnected - //close(conn); - - if (irc_reconnect(&conn)==-1) + while (-1 == irc_reconnect(&conn)) { - while (-1 == irc_reconnect(&conn)) - { - printf("Reconnect in 10 sec\n"); - sleep(10); - } - sleep(1); + printf("Reconnect in 10 sec\n"); + sleep(10); } - //send some commands to irc to register nick - snprintf(cmd_buf, TH_CONN_BUF_SZ, "USER %s 0 0 :%s\r\n", cfg->user, cfg->user); - write(conn.conn_fd, cmd_buf, strlen(cmd_buf)); - snprintf(cmd_buf, TH_CONN_BUF_SZ,"NICK %s \r\n", cfg->user); - write(conn.conn_fd, cmd_buf, strlen(cmd_buf)); - + sleep(1); } + //send some commands to irc to register nick + snprintf(cmd_buf, TH_CONN_BUF_SZ, "USER %s 0 0 :%s\r\n", cfg->user, cfg->user); + write(conn.conn_fd, cmd_buf, strlen(cmd_buf)); + snprintf(cmd_buf, TH_CONN_BUF_SZ,"NICK %s \r\n", cfg->user); + write(conn.conn_fd, cmd_buf, strlen(cmd_buf)); } else { - perror("No conn"); - PRINT(">>READ %d <<\n",cret); - PRINT("CRET %d CONN %d LIBC %d\n", cret, conn.err, conn.liberr); - sleep(1); if (conn.err == ERR_SC_TIMEOUT) { printf("TIMEOUT\n"); @@ -609,10 +595,7 @@ int th_start_client(void *data) //send command over queue } - - printf("End client\n"); - PNL(); atomic_fetch_sub( &cfg->running,1); return 0; diff --git a/sock_conn.c b/sock_conn.c index 119dd10..c926dd1 100644 --- a/sock_conn.c +++ b/sock_conn.c @@ -499,7 +499,6 @@ int irc_reconnect(irc_conn *conn) irc_conn reconn; - PNL(); if (conn == NULL) { PERM(); @@ -515,7 +514,7 @@ int irc_reconnect(irc_conn *conn) timeout = timeout; fret = irc_open(hostname, port, &reconn); - if (fret==-1) + if (-1 == fret) { ENL(); return -1; @@ -529,7 +528,6 @@ int irc_reconnect(irc_conn *conn) //BUG lets think about this case deeper //free(hostname); //free(port); - PNL(); memcpy(conn, &reconn, sizeof(irc_conn)); |