From: rjk@greenend.org.uk <> Date: Tue, 10 Jul 2007 23:14:31 +0000 (+0100) Subject: disobedience more robust against server restart X-Git-Tag: debian-1_5_99dev8~273 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/346ba8d53eb0c9cead1d3818eedc1b004ea938af disobedience more robust against server restart --- diff --git a/disobedience/TODO b/disobedience/TODO index 96cd6b9..31168db 100644 --- a/disobedience/TODO +++ b/disobedience/TODO @@ -4,7 +4,4 @@ search select tracks by tag general: - If the server stops then disobedience crashes. Specifically, - disorder_eclient_polled() finds a stashed 'command' with a - callback of authbanner_opcallback, and a NULL cmd, in - state_idle and c->authenticated nonzero. + disobedience doesn't like starting up if the server isn't running. diff --git a/disobedience/disobedience.c b/disobedience/disobedience.c index 9ee7b33..5fe0a28 100644 --- a/disobedience/disobedience.c +++ b/disobedience/disobedience.c @@ -335,6 +335,7 @@ int main(int argc, char **argv) { default: fatal(0, "invalid option"); } } + signal(SIGPIPE, SIG_IGN); /* create the event loop */ D(("create main loop")); mainloop = g_main_loop_new(0, 0); diff --git a/lib/eclient.c b/lib/eclient.c index 971dc4c..519e603 100644 --- a/lib/eclient.c +++ b/lib/eclient.c @@ -546,8 +546,10 @@ static void read_input(disorder_eclient *c) { if(c->state > state_connecting) consume(&c->input, (nl - c->input.vec) + 1); } - if(c->eof) + if(c->eof) { comms_error(c, "reading from %s: server disconnected", c->ident); + c->authenticated = 0; + } } /* called with a line that has just been read */