From 346ba8d53eb0c9cead1d3818eedc1b004ea938af Mon Sep 17 00:00:00 2001 Message-Id: <346ba8d53eb0c9cead1d3818eedc1b004ea938af.1714041719.git.mdw@distorted.org.uk> From: Mark Wooding Date: Wed, 11 Jul 2007 00:14:31 +0100 Subject: [PATCH] disobedience more robust against server restart Organization: Straylight/Edgeware From: rjk@greenend.org.uk <> --- disobedience/TODO | 5 +---- disobedience/disobedience.c | 1 + lib/eclient.c | 4 +++- 3 files changed, 5 insertions(+), 5 deletions(-) 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 */ -- [mdw]