From 6cb3bab50c45cd82cd65aea4682b37a4e4e1d29e Mon Sep 17 00:00:00 2001 From: Tobias Girstmair Date: Sun, 26 May 2024 13:54:01 +0200 Subject: [PATCH] Revert "send all initialization commands at once" nope, causes hangs. This reverts commit 3051579fa02b967abe558353cc6537bcedd75d8f. --- ircpipe.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ircpipe.c b/ircpipe.c index 09c1036..034c2fb 100644 --- a/ircpipe.c +++ b/ircpipe.c @@ -237,17 +237,20 @@ int irc_setup(const sock_t sock, const int outfd, const char *nick, const char * WRITE(sock, "CAP END\r\n", 9); } + /* block until we get a RPL_WELCOME or an error: */ + n = irc_wait(sock, outfd, NICK, buf); + if (n < 0) return n; + if (chan) { n = snprintf(buf, BUFSIZ, "JOIN %s\r\n", chan); WRITE(sock, buf, n); + /* block until we get a JOIN response or an error: */ n = irc_wait(sock, outfd, JOIN, buf); - } else { - /* block until we get a RPL_WELCOME or an error: */ - n = irc_wait(sock, outfd, NICK, buf); + if (n < 0) return n; } - return n; + return 0; } long irc_time() { -- 2.39.3