Tcl Source Code

Changes On Branch win-sock-async-connect-race-fix
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch win-sock-async-connect-race-fix Excluding Merge-Ins

This is equivalent to a diff from 279154c448 to 521b7229c4

2014-03-09
21:55
Mark io-35.18b test as knownBug check-in: 4fb211cd74 user: jan.nijtmans tags: core-8-5-branch
2014-03-08
00:21
socket -async and gets/puts stall on windows (Ticket [336441ed59])

This is a change for a problem... Closed-Leaf check-in: 521b7229c4 user: andreask tags: win-sock-async-connect-race-fix

2014-02-27
20:21
Work in progress attempting a ReadChars rewrite. check-in: 914a1b6351 user: dgp tags: dgp-read-chars
2014-02-26
20:28
merge 8.5 check-in: 27707adf73 user: dgp tags: dgp-read-bytes
17:47
New tests covering INPUT_NEED_NL flag handling. One exposes a bug. check-in: 279154c448 user: dgp tags: core-8-5-branch
2014-02-24
17:25
Do not reopen a win serial channel for serial detection. There are issues with some Bluetooth virtua... check-in: b6459ef66c user: oehhar tags: core-8-5-branch

Changes to win/tclWinSock.c.

1206
1207
1208
1209
1210
1211
1212









1213
1214
1215
1216
1217
1218
1219

    while (1) {
	if (infoPtr->lastError) {
	    *errorCodePtr = infoPtr->lastError;
	    result = 0;
	    break;
	} else if (infoPtr->readyEvents & events) {









	    break;
	} else if (infoPtr->flags & SOCKET_ASYNC) {
	    *errorCodePtr = EWOULDBLOCK;
	    result = 0;
	    break;
	}








>
>
>
>
>
>
>
>
>







1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228

    while (1) {
	if (infoPtr->lastError) {
	    *errorCodePtr = infoPtr->lastError;
	    result = 0;
	    break;
	} else if (infoPtr->readyEvents & events) {
	    break;
	} else if ((events == FD_CONNECT) && 
		   !(infoPtr->flags & SOCKET_ASYNC_CONNECT)) {
	    /* When waiting for FD_CONNECT Windows may not deliver this event,
	     * causing us to get stuck. However, SocketProc()'s SOCKET_MESSAGE
	     * handler has special code which detects this and resets the
	     * infoPtr->flags async bit anyway (See (xxx)). That we can detect
	     * here and break the loop as if we had gotten FD_CONNECT.
	     */
	    break;
	} else if (infoPtr->flags & SOCKET_ASYNC) {
	    *errorCodePtr = EWOULDBLOCK;
	    result = 0;
	    break;
	}

2323
2324
2325
2326
2327
2328
2329

2330
2331
2332
2333
2334
2335
2336

		    if (error != ERROR_SUCCESS) {
			TclWinConvertWSAError((DWORD) error);
			infoPtr->lastError = Tcl_GetErrno();
		    }
		}


		if (infoPtr->flags & SOCKET_ASYNC_CONNECT) {
		    infoPtr->flags &= ~(SOCKET_ASYNC_CONNECT);
		    if (error != ERROR_SUCCESS) {
			TclWinConvertWSAError((DWORD) error);
			infoPtr->lastError = Tcl_GetErrno();
		    }
		    infoPtr->readyEvents |= FD_WRITE;







>







2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346

		    if (error != ERROR_SUCCESS) {
			TclWinConvertWSAError((DWORD) error);
			infoPtr->lastError = Tcl_GetErrno();
		    }
		}

		/* (xxx) See corresponding marker in WaitForSocketEvent as well */
		if (infoPtr->flags & SOCKET_ASYNC_CONNECT) {
		    infoPtr->flags &= ~(SOCKET_ASYNC_CONNECT);
		    if (error != ERROR_SUCCESS) {
			TclWinConvertWSAError((DWORD) error);
			infoPtr->lastError = Tcl_GetErrno();
		    }
		    infoPtr->readyEvents |= FD_WRITE;