diff src/server.c @ 188:f1bacee93ca6 noffle

[svn] * src/client.c,src/client.h,src/fetch.c,src/noffle.c,src/server.c: robustness - instead of retruning simple Passed/Failed statuses from connection functions, return an integer status instead. This allows Noffle to distinguish between a connection failure, an unrecoverable protocol error and a recoverable problem. As a concrete instance, Noffle will no longer abort the connection if a group is removed from the upstream server. Also beef up error detection a bit. * src/content.c: instead of overwriting the existing content file(s) when updating - which leaves a window where Noffle is vulnerable to failure which will leave the content file corrupted (yes, it happened to me), write a new content file and rename it over the old file only when it has been written and closed with no errors reported.
author bears
date Wed, 12 Sep 2001 21:33:44 +0100
parents fed1334d766b
children 28488e0e3630
line wrap: on
line diff
--- a/src/server.c	Sat Sep 01 16:57:45 2001 +0100
+++ b/src/server.c	Wed Sep 12 21:33:44 2001 +0100
@@ -1,7 +1,7 @@
 /*
   server.c
 
-  $Id: server.c 300 2001-08-05 08:24:22Z bears $
+  $Id: server.c 307 2001-09-12 20:33:44Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -394,6 +394,7 @@
 retrieveArt( const char *msgId )
 {
     Str s;
+    int stat;
 
     findServer( msgId, s );    
     if ( strcmp( s, "(unknown)" ) == 0 
@@ -405,8 +406,15 @@
         Online_set( FALSE );
         return FALSE;
     }
-    Client_retrieveArt( msgId );
+    stat = Client_retrieveArt( msgId );
     Client_disconnect();
+    if ( IS_FATAL( stat ) )
+    {
+        Log_inf( "Server connection failed or newsbase problem. "
+		 "Leaving online mode." );        
+        Online_set( FALSE );
+        return FALSE;
+    }
     return TRUE;
 }