diff options
author | Luke Bratch <luke@bratch.co.uk> | 2019-06-12 21:58:47 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2019-06-12 21:58:47 +0100 |
commit | 3038e93b7e2e34296429a078b70205448c81e6cb (patch) | |
tree | 519afe1a2719f375fd830aedb3d8f097ff493bed /blabouncer.c | |
parent | c086e7d588008d7ebbb94c368fbcb8c4774ad6cb (diff) |
Don't print server or client recv() errors to the terminal, debugprint() them properly instead.
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/blabouncer.c b/blabouncer.c index bbb22cd..567de57 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -544,13 +544,9 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { debugprint(DEBUG_FULL, "reading server socket!\n"); if ((servernumbytes = sockread(server_ssl, serverbuf, MAXRCVSIZE - 1, settings->servertls)) == -1) { - perror("recv"); - printf("receive error (-1), skipping loop iteration...\n"); - debugprint(DEBUG_CRIT, "serversockfd receive error (-1), skipping loop iteration, errno '%d'.\n"); + debugprint(DEBUG_CRIT, "dochat(): server sockread() error (-1) (%s), skipping loop iteration.\n", strerror(errno)); } else if (servernumbytes == 0) { - perror("recv"); - printf("socket closed (or no data received) (0), skipping loop iteration...\n"); - debugprint(DEBUG_CRIT, "serversockfd socket closed (or no data received) (0), skipping loop iteration, errno '%d'.\n"); + debugprint(DEBUG_CRIT, "dochat(): server sockread() closed or no data received (0) (%s), skipping loop iteration.\n", strerror(errno)); } // If there was a socket error (receive error or socket closed) @@ -723,8 +719,7 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { // connection closed debugprint(DEBUG_SOME, "bouncer-client: socket %d hung up\n", i); } else { - perror("recv"); - debugprint(DEBUG_CRIT, "bouncer-client: socket error, clientnum bytes '%d', errno '%d'.\n", clientnumbytes, errno); + debugprint(DEBUG_CRIT, "dochat(): client sockread() error (%s) (%s).\n", clientnumbytes, strerror(errno)); } // Disconnect the client disconnectclient(i, clients, &ircdstate, settings); |