nanogui: Thread: 0.89pre6 Bug Report.


[<<] [<] Page 1 of 1 [>] [>>]
Subject: 0.89pre6 Bug Report.
From: Yang Jingsong ####@####.####
Date: 5 Dec 2000 14:14:02 -0000
Message-Id: <3A2D6999.6030106@mail.topresult.com>

We find a bug in Microwindows 0.89 pre 6 version, pleaes check it out.

Now we are designing a network product, using Microwindows as the GUI, 
we do next step:

step 1. Create a socket, and connect to ther server.
step 2. Add the socket(file description) to FD_SET.
   Because of Microwindows providing a mechanism to listen the fds, we 
call MwRegisterFdInput(MainHwnd, fd) and
   MwRegisterFdOutput(MainHwnd, fd).
step 3. The network cannot work and my mouse and keyboard are not 
working yet! What's wrong with it?
step 4.  We check the winmain.c source file, and found that 
MwRegisterFdInput()/MwRegisterFdOutput()/MwRegisterFdExcept() have some 
error.
   For example, I can register a socket for reading and writing at the 
same time, but when I register the socket for reading, in 
MwRegisterFdInput() will set this socket's read field(HWND), and set the 
next with "-1"(assume I have only a socket Added.) Then call 
MwRegisterFdOutput() will set this socket's write field(HWND), and set 
the next with userregfd_head(now userregfd_head == this socket fd), so 
here's a dead loop! When goes into MwSelect(), load user register fds 
into FD_SET, will dead loop!
step 5. Fix this bug.
  please modify winmain.c:
    (1)In function void MwRegsterFdInput(HWND hwnd, int fd), replace "if 
(userregfd[fd].next == -1)" with "if ((userregfd[fd].next == -1) && 
(!userregfd[fd].write) && (!userregfd[fd].except))".
    (2)In function void MwRegsterFdOutput(HWND hwnd, int fd), replace 
"if (userregfd[fd].next == -1)" with "if ((userregfd[fd].next == -1) && 
(!userregfd[fd].read) && (!userregfd[fd].except))".
    (3)In function void MwRegsterFdExcept(HWND hwnd, int fd), replace 
"if (userregfd[fd].next == -1)" with "if ((userregfd[fd].next == -1) && 
(!userregfd[fd].write) && (!userregfd[fd].read))".

I'm very sorry that my English is too poor, and could not descript the 
fact clearly, please try use next code.

int socketfd;
socketfd = socket();  // Create a socket
connect();  // Connect to server
MwRegisterFdInput(hwnd, socketfd);    // Register to Microwindows
MwRegisterFdOutput(hwnd, socketfd); // Register to Microwindows

// In  MwSelect(), dead loop.

 
Best regards,
Yang Jingsong.
####@####.####

SEL SYSTEM LTD.
www.sellinux.com
B6 Minghu Building, 
#24 Huangsi, 
Xicheng District, 
Beijing, China 100011 
Tel:(86-10)62077500/01/02-243 
Fax:(86-10)62077553

[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.