disobedience more robust against server restart
authorrjk@greenend.org.uk <>
Tue, 10 Jul 2007 23:14:31 +0000 (00:14 +0100)
committerrjk@greenend.org.uk <>
Tue, 10 Jul 2007 23:14:31 +0000 (00:14 +0100)
disobedience/TODO
disobedience/disobedience.c
lib/eclient.c

index 96cd6b9..31168db 100644 (file)
@@ -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.
index 9ee7b33..5fe0a28 100644 (file)
@@ -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);
index 971dc4c..519e603 100644 (file)
@@ -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 */