Tcl Source Code

Check-in [cb1a6a0924]
Login

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

Overview
Comment:No [fconfigure -error] error in connect process; gets after failed async connect returns connect error
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-13d3af3ad5
Files: files | file ages | folders
SHA1: cb1a6a0924b0ac27166041bb1a2e5456ed5f775a
User & Date: oehhar 2014-03-11 13:35:37
Context
2014-03-11
17:34
  • Hide transient errors of the internal iterations of [socket -async] from the script level. * ...
check-in: 5fafcb7857 user: max tags: bug-13d3af3ad5
13:35
No [fconfigure -error] error in connect process; gets after failed async connect returns connect err... check-in: cb1a6a0924 user: oehhar tags: bug-13d3af3ad5
2014-03-10
18:11
WaitForConnect may only call back to CreateClientSocket when the socket is writable or something. Wh... check-in: d2b5426431 user: max tags: bug-13d3af3ad5
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to win/tclWinSock.c.

1245
1246
1247
1248
1249
1250
1251

1252
1253
1254
1255
1256
1257
1258
	    /* get infoPtr lock */
	    WaitForSingleObject(tsdPtr->socketListLock, INFINITE);

	    /*
	     * Reset last error from last try
	     */
	    infoPtr->lastError = 0;

	    
	    infoPtr->sockets->fd = socket(infoPtr->myaddr->ai_family, SOCK_STREAM, 0);
	    
	    /* Free list lock */
	    SetEvent(tsdPtr->socketListLock);

	    /* continue on socket creation error */







>







1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
	    /* get infoPtr lock */
	    WaitForSingleObject(tsdPtr->socketListLock, INFINITE);

	    /*
	     * Reset last error from last try
	     */
	    infoPtr->lastError = 0;
	    Tcl_SetErrno(0);
	    
	    infoPtr->sockets->fd = socket(infoPtr->myaddr->ai_family, SOCK_STREAM, 0);
	    
	    /* Free list lock */
	    SetEvent(tsdPtr->socketListLock);

	    /* continue on socket creation error */
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
		if ( infoPtr->flags & SOCKET_REENTER_PENDING ) {
		    *errorCodePtr = EWOULDBLOCK;
		    return 0;
		}
		return 1;
	    }
	    /* error case */
	    *errorCodePtr = EFAULT;
	    return 1;
	}

        /* Free list lock */
        SetEvent(tsdPtr->socketListLock);

	/*
	 * A non blocking socket waiting for an asyncronous connect







|
|







1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
		if ( infoPtr->flags & SOCKET_REENTER_PENDING ) {
		    *errorCodePtr = EWOULDBLOCK;
		    return 0;
		}
		return 1;
	    }
	    /* error case */
	    *errorCodePtr = Tcl_GetErrno();
	    return 0;
	}

        /* Free list lock */
        SetEvent(tsdPtr->socketListLock);

	/*
	 * A non blocking socket waiting for an asyncronous connect
2413
2414
2415
2416
2417
2418
2419
2420
2421








2422
2423
2424
2425
2426
2427
2428

2429
2430
2431
2432
2433
2434
2435
    sock = infoPtr->sockets->fd;
    if (optionName != NULL) {
	len = strlen(optionName);
    }

    if ((len > 1) && (optionName[1] == 'e') &&
	    (strncmp(optionName, "-error", len) == 0)) {
	int optlen;
	DWORD err;








	int ret;

	optlen = sizeof(int);
	ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR,
		(char *)&err, &optlen);
	if (ret == SOCKET_ERROR) {
	    err = WSAGetLastError();

	}
	if (err) {
	    TclWinConvertError(err);
	    Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1);
	}
	return TCL_OK;
    }







<

>
>
>
>
>
>
>
>
|

|
|
|
|
|
>







2414
2415
2416
2417
2418
2419
2420

2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
    sock = infoPtr->sockets->fd;
    if (optionName != NULL) {
	len = strlen(optionName);
    }

    if ((len > 1) && (optionName[1] == 'e') &&
	    (strncmp(optionName, "-error", len) == 0)) {

	DWORD err;
	/*
	 * Check if an asyncroneous connect is running
	 * and return ok
	 */
	if (infoPtr->flags & SOCKET_REENTER_PENDING) {
	    err = 0;
	} else {
	    int optlen;
	    int ret;

	    optlen = sizeof(int);
	    ret = TclWinGetSockOpt(sock, SOL_SOCKET, SO_ERROR,
		    (char *)&err, &optlen);
	    if (ret == SOCKET_ERROR) {
		err = WSAGetLastError();
	    }
	}
	if (err) {
	    TclWinConvertError(err);
	    Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(Tcl_GetErrno()), -1);
	}
	return TCL_OK;
    }