Coda File System

Re: a stray diff from my source tree

From: Jan Harkes <jaharkes_at_cs.cmu.edu>
Date: Sun, 25 Feb 2001 13:38:42 -0500
On Sun, Feb 25, 2001 at 12:04:32PM -0500, Greg Troxel wrote:
> I added this, IIRC, to avoid a panic in the timer code on
> 'masqueraded' venus machines.  Should this be in the real sources, or
> has this been fixed some other way?

I had figured that disabling the retransmit timeout handling for SFTP
wasn't really the right thing. So it did get fixed in another way as
the following change was committed to CVS a while ago.

Jan


2000/11/20 15:25:20     <jaharkes_at_chios.odyssey.cs.cmu.edu>

        -masquerade bugs, forgot to initializesftp timeout chain. And we
	still need to run the sftp_Listener to handle any sftp timeouts.

    Modified files:
	rpc2/rpc2-src/: sftp1.c sftp2.c
			        

Index: sftp1.c
===================================================================
RCS file: /coda-src/rpc2/rpc2-src/sftp1.c,v
retrieving revision 4.38
retrieving revision 4.39
diff -u -u -r4.38 -r4.39
--- sftp1.c	2000/10/31 16:20:26	4.38
+++ sftp1.c	2000/11/20 15:25:19	4.39
@@ -105,17 +105,20 @@
     
     say(0, SFTP_DebugLevel, "SFTP_Init()\n");
 
+    /* initialize the sftp timer chain */
+    TM_Init(&sftp_Chain);
+
     if (sftp_Port.Tag)
     {
         /* Create socket for SFTP packets */
         if (rpc2_CreateIPSocket(&sftp_Socket, &sftp_Port) != RPC2_SUCCESS)
             return(RPC2_FAIL);
-
-        /* Create SFTP listener process */
-        sname = "sftp_Listener";
-        LWP_CreateProcess((PFIC)sftp_Listener, 16384, LWP_NORMAL_PRIORITY,
-                          sname, sname, &sftp_ListenerPID);
     }
+
+    /* Create SFTP listener process */
+    sname = "sftp_Listener";
+    LWP_CreateProcess((PFIC)sftp_Listener, 16384, LWP_NORMAL_PRIORITY,
+		      sname, sname, &sftp_ListenerPID);
 
     sftp_InitTrace();
 
Index: sftp2.c
===================================================================
RCS file: /coda-src/rpc2/rpc2-src/sftp2.c,v
retrieving revision 4.30
retrieving revision 4.31
diff -u -u -r4.30 -r4.31
--- sftp2.c	2000/10/31 16:20:27	4.30
+++ sftp2.c	2000/11/20 15:25:20	4.31
@@ -77,18 +77,12 @@
 
 void sftp_Listener(void)
 {/* LWP that listens for SFTP packets */
-    
-    TM_Init(&sftp_Chain);
-
-    while (TRUE)
-	{
+    while (TRUE) {
 	ScanTimerQ();	/* wakeup all LWPs with expired timer entries */
 
-	if (AwaitEvent() <= 0)
-		continue; /* timeout or bogus wakeup */
-	
-	sftp_ProcessPackets();
-	}
+	if (AwaitEvent() > 0) /* any packets available? */
+	    sftp_ProcessPackets();
+    }
 }
 
 /* This function is not called by the sftp code itself */
@@ -208,18 +202,19 @@
     fd_set rmask;
     struct timeval *tvp;
     struct TM_Elem *t;
-    int nfds, rc;
+    int nfds = 0, rc;
     
     /* wait for packet or earliest timeout */
     t = TM_GetEarliest(sftp_Chain);
     if (t == NULL) tvp = NULL;
     else tvp = &t->TimeLeft;
 
-    assert(sftp_Port.Tag);
-    
     FD_ZERO(&rmask);
-    FD_SET(sftp_Socket, &rmask);
-    nfds = sftp_Socket + 1;
+
+    if (sftp_Port.Tag) {
+	FD_SET(sftp_Socket, &rmask);
+	nfds = sftp_Socket + 1;
+    }
 
     /* Only place where sftp_Listener() gives up control */
     rc = IOMGR_Select(nfds, &rmask, NULL, NULL, tvp);
Received on 2001-02-25 13:38:55