comparison 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
comparison
equal deleted inserted replaced
187:166008a80f03 188:f1bacee93ca6
1 /* 1 /*
2 server.c 2 server.c
3 3
4 $Id: server.c 300 2001-08-05 08:24:22Z bears $ 4 $Id: server.c 307 2001-09-12 20:33:44Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
392 392
393 static Bool 393 static Bool
394 retrieveArt( const char *msgId ) 394 retrieveArt( const char *msgId )
395 { 395 {
396 Str s; 396 Str s;
397 int stat;
397 398
398 findServer( msgId, s ); 399 findServer( msgId, s );
399 if ( strcmp( s, "(unknown)" ) == 0 400 if ( strcmp( s, "(unknown)" ) == 0
400 || strcmp( s, GRP_LOCAL_SERVER_NAME ) == 0 ) 401 || strcmp( s, GRP_LOCAL_SERVER_NAME ) == 0 )
401 return FALSE; 402 return FALSE;
403 { 404 {
404 Log_inf( "Connection to server failed. Leaving online mode." ); 405 Log_inf( "Connection to server failed. Leaving online mode." );
405 Online_set( FALSE ); 406 Online_set( FALSE );
406 return FALSE; 407 return FALSE;
407 } 408 }
408 Client_retrieveArt( msgId ); 409 stat = Client_retrieveArt( msgId );
409 Client_disconnect(); 410 Client_disconnect();
411 if ( IS_FATAL( stat ) )
412 {
413 Log_inf( "Server connection failed or newsbase problem. "
414 "Leaving online mode." );
415 Online_set( FALSE );
416 return FALSE;
417 }
410 return TRUE; 418 return TRUE;
411 } 419 }
412 420
413 static Bool 421 static Bool
414 checkNumb( int numb ) 422 checkNumb( int numb )