comparison src/server.c @ 269:b3a2f710fe2c noffle

[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the server yielded the lock to another server.
author bears
date Fri, 25 Oct 2002 12:04:57 +0100
parents 94b7962a0fbe
children 3477050e8d10
comparison
equal deleted inserted replaced
268:f049f8639dc0 269:b3a2f710fe2c
1 /* 1 /*
2 server.c 2 server.c
3 3
4 $Id: server.c 396 2002-08-05 22:05:02Z bears $ 4 $Id: server.c 401 2002-10-25 11:04:57Z 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
312 Otherwise it will be lost when the content is discarded. */ 312 Otherwise it will be lost when the content is discarded. */
313 } 313 }
314 } 314 }
315 315
316 static void 316 static void
317 changeToGrp( const char *grp ) 317 loadGrpInfo( const char *grp )
318 { 318 {
319 checkNewArts( grp ); 319 checkNewArts( grp );
320 Utl_cpyStr( server.grp, grp ); 320 Utl_cpyStr( server.grp, grp );
321 readCont( grp ); 321 readCont( grp );
322
323 /*
324 * This routine is used to change back to a group after releasing
325 * the lock. We need to preserve the group cursor if at all possible.
326 * So, if the article pointer points to an article before or after
327 * the current range, adjust it to the first/last article. Otherwise
328 * leave it well alone.
329 */
330 if ( server.artPtr < Cont_first() )
331 server.artPtr = Cont_first();
332 else if ( server.artPtr > Cont_last() )
333 server.artPtr = Cont_last();
334
335 server.groupReady = TRUE;
336 }
337
338 static void
339 changeToGrp( const char *grp )
340 {
341 loadGrpInfo( grp );
322 server.artPtr = Cont_first(); 342 server.artPtr = Cont_first();
323 server.groupReady = TRUE;
324 } 343 }
325 344
326 static Bool 345 static Bool
327 doGrp( char *arg, const Cmd *cmd ) 346 doGrp( char *arg, const Cmd *cmd )
328 { 347 {
368 return FALSE; 387 return FALSE;
369 } 388 }
370 if ( ! server.groupReady ) 389 if ( ! server.groupReady )
371 { 390 {
372 Utl_cpyStr( group, server.grp ); 391 Utl_cpyStr( group, server.grp );
373 changeToGrp( group ); 392 loadGrpInfo( group );
374 } 393 }
375 return TRUE; 394 return TRUE;
376 } 395 }
377 396
378 static void 397 static void