Check-in [6cad1c95a2]
Overview
Comment:Partial fix for test case tlsIO-9.1 to flush then wait for handshake to finish before close
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | main
Files: files | file ages | folders
SHA3-256: 6cad1c95a2ca6fcaaea1fc1e97893f7d436466d96727ba52b179fc2355ca91f3
User & Date: bohagan on 2024-12-16 01:35:18
Other Links: branch diff | manifest | tags
Context
2024-12-17
01:24
Corrected install pkgIndex.tcl file path check-in: 68b20030ff user: bohagan tags: trunk, main
2024-12-16
01:35
Partial fix for test case tlsIO-9.1 to flush then wait for handshake to finish before close check-in: 6cad1c95a2 user: bohagan tags: trunk, main
2024-12-15
22:49
Removed sending another error code after failed connection is detected. Also fixes test case tls-bug58-1.0. check-in: 2a3c49aad4 user: bohagan tags: trunk, main
Changes
75
76
77
78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
75
76
77
78
79
80
81


82
83
84
85
86
87
88
89
90
91
92
93







-
-




+







 *-----------------------------------------------------------------------------
 */
static int TlsCloseProc(ClientData instanceData, Tcl_Interp *interp) {
    State *statePtr = (State *) instanceData;

    dprintf("TlsCloseProc(%p)", (void *) statePtr);

    /* Flush any pending data */

    /* Send shutdown notification. Will return 0 while in process, then 1 when complete. */
    /* Closes the write direction of the connection; the read direction is closed by the peer. */
    /* Does not affect socket state. Don't call after fatal error. */
    if (statePtr->ssl != NULL && !(statePtr->flags & TLS_TCL_HANDSHAKE_FAILED)) {
	BIO_flush(statePtr->bio);
	SSL_shutdown(statePtr->ssl);
    }

    /* Tls_Free calls Tls_Clean */
    Tcl_EventuallyFree((ClientData)statePtr, Tls_Free);
    return 0;
}
1140
1141
1142
1143
1144
1145
1146
1147


1148
1149
1150


1151

1152
1153
1154
1155
1156
1157
1158
1140
1141
1142
1143
1144
1145
1146

1147
1148
1149
1150
1151
1152
1153

1154
1155
1156
1157
1158
1159
1160
1161







-
+
+



+
+
-
+







    set c [tls::socket \
	    -certfile $clientCert -cafile $caCert -keyfile $clientKey \
	    localhost 8831]
    # This differs from socket-9.1 in that both sides need to be
    # non-blocking because of TLS' required handshake
    fconfigure $c -blocking 0
    puts -nonewline $c 01234567890123456789012345678901234567890123456789
    close $c
    flush $c
    set timer2 [after 2000 [list close $c]]
    set timer [after 10000 "set done timed_out"]
    vwait done
    after cancel $timer
    after cancel $timer2
    catch {close $c}
    close $s
    catch {close $s}
    list $spurious $len
} {0 50}

test tlsIO-9.2 {testing async write, fileevents, flush on close} {socket} {
    set firstblock [string repeat a 31]
    set secondblock [string repeat b 65535]
    proc accept {s a p} {