changeset 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 f049f8639dc0
children d6fedc09b052
files ChangeLog src/server.c
diffstat 2 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 08 14:52:52 2002 +0100
+++ b/ChangeLog	Fri Oct 25 12:04:57 2002 +0100
@@ -1,3 +1,8 @@
+Tue Oct 25 2002 Jim Hague <jim.hague@acm.org>
+
+* src/server.c: Fix post 1.0 bug where the article cursor was lost if the
+  server yielded the lock to another server.
+	
 Tue Oct 8 2002 Jim Hague <jim.hague@acm.org>
 
 * src/client.c: Fix old bug in readField() where the last field in a line
--- a/src/server.c	Tue Oct 08 14:52:52 2002 +0100
+++ b/src/server.c	Fri Oct 25 12:04:57 2002 +0100
@@ -1,7 +1,7 @@
 /*
   server.c
 
-  $Id: server.c 396 2002-08-05 22:05:02Z bears $
+  $Id: server.c 401 2002-10-25 11:04:57Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -314,13 +314,32 @@
 }
 
 static void
-changeToGrp( const char *grp )
+loadGrpInfo( const char *grp )
 {
     checkNewArts( grp );
     Utl_cpyStr( server.grp, grp );
     readCont( grp );
+
+    /*
+     * This routine is used to change back to a group after releasing
+     * the lock. We need to preserve the group cursor if at all possible.
+     * So, if the article pointer points to an article before or after
+     * the current range, adjust it to the first/last article. Otherwise
+     * leave it well alone.
+     */
+    if ( server.artPtr < Cont_first() )
+	server.artPtr = Cont_first();
+    else if ( server.artPtr > Cont_last() )
+	server.artPtr = Cont_last();
+    
+    server.groupReady = TRUE;
+}
+
+static void
+changeToGrp( const char *grp )
+{
+    loadGrpInfo( grp );
     server.artPtr = Cont_first();
-    server.groupReady = TRUE;
 }
 
 static Bool
@@ -370,7 +389,7 @@
     if ( ! server.groupReady )
     {
     	Utl_cpyStr( group, server.grp );
-    	changeToGrp( group );
+    	loadGrpInfo( group );
     }
     return TRUE;
 }