aboutsummaryrefslogtreecommitdiffstats
path: root/sircbot.c
diff options
context:
space:
mode:
Diffstat (limited to 'sircbot.c')
-rw-r--r--sircbot.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sircbot.c b/sircbot.c
index 30f870f..67dc5a9 100644
--- a/sircbot.c
+++ b/sircbot.c
@@ -348,9 +348,20 @@ static int irc_loop(struct irc_session *sess, struct sircbot_channel *chan,
send_fifo_queue(sess, &chan[i-1], now) < 0)
goto ret_err;
- if ((fds[i].revents & POLLHUP) && i == 0)
- /* server hang up on us */
- return 0;
+ if (fds[i].revents & POLLHUP) {
+ if (i == 0)
+ /* server hang up on us */
+ return 0;
+
+ /* one of the fifos closed due to
+ writer process exit. We just
+ reopen it assuming we are still
+ joined the channel */
+ close_fifo(&chan[i-1],
+ chan[i-1].last_closetime);
+ init_fifo(&chan[i-1]);
+ continue;
+ }
if (fds[i].revents & POLLERR)
goto ret_err;