AmendHub

Download:

jcs

/

wallops

/

amendments

/

16

irc: Fix PONG, print TCP errors rather than use warn()


jcs made amendment 16 over 2 years ago
--- irc.c Mon Feb 7 22:21:06 2022 +++ irc.c Tue Feb 8 08:11:19 2022 @@ -168,7 +168,8 @@ irc_recv(struct chatter *chatter) error = _TCPStatus(&chatter->irc_rcv_pb, chatter->irc_stream, &chatter->irc_status_pb, nil, nil, false); if (error) { - irc_close(chatter); + chatter_printf(chatter, "$B*!* TCPStatus failed: %d$0", error); + irc_abort(chatter); return 0; } @@ -216,8 +217,9 @@ irc_send(struct chatter *chatter, char *line, size_t s SystemTask(); if (chatter->irc_send_pb.ioResult < 0) { - warn("TCPSend failed: %d", chatter->irc_send_pb.ioResult); - irc_close(chatter); + chatter_printf(chatter, "$B*!* TCPSend failed: %d$0", + chatter->irc_send_pb.ioResult); + irc_abort(chatter); return 0; } @@ -237,8 +239,8 @@ irc_send(struct chatter *chatter, char *line, size_t s error = _TCPSend(&chatter->irc_send_pb, chatter->irc_stream, chatter->irc_wds, nil, nil, true); if (error) { - warn("TCPSend failed: %d", error); - irc_close(chatter); + chatter_printf(chatter, "$B*!* TCPSend failed: %d$0", error); + irc_abort(chatter); return 0; } @@ -422,7 +424,7 @@ irc_process_server(struct chatter *chatter) done_parsing: if (msg.cmd[0]) { if (strcmp(msg.cmd, "PING") == 0) { - irc_printf(chatter, "PONG :%s\r\n", msg.source); + irc_printf(chatter, "PONG :%s\r\n", msg.msg); return; } if (strcmp(msg.cmd, "PRIVMSG") == 0) {