Vanilla Clients Maling Clients Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [VANILLA-CLIENTS:49] autologin bug in COW/N:1999



Ok, this quick hack definately does not work.

 I'm not reading this spaghetti code correctly.  By making my little change,
what appears to happen is attempts are made to readfromserver() when there
is no data, and it seems to hang waiting for something.

 Ahh, need comments in code :)  Ohwell, I'm looking at BRMH code now to see
how it handles this function.

Steve

> -----Original Message-----
> From: Steve Sheldon [mailto:sheldon@visi.com]
> Sent: Monday, April 19, 1999 12:29 AM
> To: vanilla-clients@us.netrek.org
> Subject: [VANILLA-CLIENTS:49] autologin bug in COW/N:1999
>
>
> Raven posted to r.g.n. a bug in COW... also exists in
> Netrek:1999.  I was
> able to pinpoint the problem down to this part of code in getname() of
> getname.c:
>
>
> -----
>       if (!autolog)
>         {
> #ifndef WIN32
>           timeout.tv_sec = 1;
>           timeout.tv_usec = 0;
> #else
>           /* Since we don't have a socket to check on Win32
>              for windowing system events, we set the timeout
> to zero and
>              effectively poll. Yes, I could do the correct thing
>              and call WaitForMultipleObjects() etc. but I
> don't feel like it
> */
>           timeout.tv_sec = 0;
>           timeout.tv_usec = 100000;
> #endif
>           FD_ZERO(&readfds);
>           FD_SET(sock, &readfds);
>           if (udpSock >= 0)
>             FD_SET(udpSock, &readfds);
> #ifndef WIN32
>           FD_SET(W_Socket(), &readfds);
> #endif
>           if (select(32, &readfds, 0, 0, &timeout) < 0)
>             {
>               perror("select");
>               continue;
>             }
>
>           if (FD_ISSET(sock, &readfds)
>               || (udpSock >= 0 && FD_ISSET(udpSock, &readfds)))
>             readFromServer(&readfds);
>
> #ifndef WIN32
>           if (FD_ISSET(W_Socket(), &readfds))
> #else
>           if (W_EventsPending())
> #endif
>             handleWEvents(defname);
>         }
>       else
>         {
>           readFromServer(&readfds);
>         }
> ----
>
>  The code dies on the readFromServer() line there...
>
>  I believe the problem is that readfds does not get
> initialized, and then
> accessed.
>
>  I believe rewriting this as:
>
> ----
> 		  {
> 			  handleWEvents(defname);
> 		  }
> 		else
> 	          {
> 	          readFromServer(&readfds);
> 		    }
> 	  }
> ----
>
>  Thus putting a bracket infront of the handleWEvents() call,
> and then a
> closer bracket after this 'if' statement, to end the (!autolog) test.
>
> Can someone verify that looks right?  It's 12:30 am, time for
> me to go to
> bed, and I quickly ran this through debug and well it "looks
> ok to me" right
> now. :)
>
>  It also appears to work in my quick test.
>
> Steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: vanilla-clients-unsubscribe@us.netrek.org
> For additional commands, e-mail: vanilla-clients-help@us.netrek.org
>
>