Tcl Source Code

Artifact [66bfdb1141]
Login

Artifact 66bfdb1141a35ede647980dbb5bd7629b76d502f:

Attachment "557878.diff" to ticket [557878ffff] added by andreas_kupries 2002-05-25 01:54:30.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.991
diff -u -r1.991 ChangeLog
--- ChangeLog	21 May 2002 18:17:54 -0000	1.991
+++ ChangeLog	24 May 2002 18:52:22 -0000
@@ -1,3 +1,10 @@
+2002-05-24  Andreas Kupries  <[email protected]>
+	
+	* win/tclWinSock.c (TcpWatchProc): Fixed SF Tcl Bug #557878. We
+	  are not allowed to mess with the watch mask if the socket is a
+	  server socket. I believe that the original reporter is George
+	  Peter Staplin.
+
 2002-05-21  Mo DeJong  <[email protected]>
 
 	* unix/configure: Regen.
@@ -307,8 +314,8 @@
 	
 	* generic/tclExecute.c:
 	* tests/compile.test: made bytecodes check for a catch before
-	returning; the compiled [return] is otherwise non-catchable. 
-	[Bug 542588] reported by Andreas Kupries.
+	  returning; the compiled [return] is otherwise non-catchable. 
+	  [Bug 542588] reported by Andreas Kupries.
 
 2002-04-15  Don Porter  <[email protected]>
 
Index: win/tclWinSock.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinSock.c,v
retrieving revision 1.25
diff -u -r1.25 tclWinSock.c
--- win/tclWinSock.c	24 Jan 2002 01:34:16 -0000	1.25
+++ win/tclWinSock.c	24 May 2002 18:52:22 -0000
@@ -2063,26 +2063,29 @@
     SocketInfo *infoPtr = (SocketInfo *) instanceData;
     
     /*
-     * Update the watch events mask.
+     * Update the watch events mask. Only if the socket is not a
+     * server socket. Fix for SF Tcl Bug #557878.
      */
-    
-    infoPtr->watchEvents = 0;
-    if (mask & TCL_READABLE) {
-	infoPtr->watchEvents |= (FD_READ|FD_CLOSE|FD_ACCEPT);
-    }
-    if (mask & TCL_WRITABLE) {
-	infoPtr->watchEvents |= (FD_WRITE|FD_CONNECT);
-    }
 
-    /*
-     * If there are any conditions already set, then tell the notifier to poll
-     * rather than block.
-     */
+    if (!infoPtr->acceptProc) {    
+        infoPtr->watchEvents = 0;
+	if (mask & TCL_READABLE) {
+	    infoPtr->watchEvents |= (FD_READ|FD_CLOSE|FD_ACCEPT);
+	}
+	if (mask & TCL_WRITABLE) {
+	    infoPtr->watchEvents |= (FD_WRITE|FD_CONNECT);
+	}
+      
+	/*
+	 * If there are any conditions already set, then tell the notifier to poll
+	 * rather than block.
+	 */
 
-    if (infoPtr->readyEvents & infoPtr->watchEvents) {
-	Tcl_Time blockTime = { 0, 0 };
-	Tcl_SetMaxBlockTime(&blockTime);
-    }		
+	if (infoPtr->readyEvents & infoPtr->watchEvents) {
+	    Tcl_Time blockTime = { 0, 0 };
+	    Tcl_SetMaxBlockTime(&blockTime);
+	}
+    }
 }
 
 /*