From b891a3c3793412bad5ae74122ece655fbee06e5d Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Tue, 16 May 2017 23:05:24 +0100 Subject: Remove debug prints --- agni.c | 43 +++++++++++++------------------------------ sock_conn.c | 4 +--- 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/agni.c b/agni.c index 398bd7c..12b2d52 100644 --- a/agni.c +++ b/agni.c @@ -534,11 +534,8 @@ int th_start_client(void *data) qcmd = NULL; } - free(msg); free(uname); - //printf("OUT<>!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)); -- cgit v1.2.3